Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jenschr/97e6b047b3b0f17f3e9a to your computer and use it in GitHub Desktop.
Save jenschr/97e6b047b3b0f17f3e9a to your computer and use it in GitHub Desktop.
Adafruit Fona modifications for Teensy 3.1, updated for latest lib + simplified
/*
Replace the first lines in your FONATest example file with the lines below. It's basically just changing from SoftwareSerial to HardwareSerial + changed pins to match the Teensy.
*/
#include <SoftwareSerial.h>
#include <HardwareSerial.h>
#include "Adafruit_FONA.h"
#define FONA_RX 1
#define FONA_TX 0
#define FONA_RST 4
// this is a large buffer for replies
char replybuffer[255];
#define HWSERIAL Serial1
HardwareSerial fonaSS = Serial1; // replaces SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX);
Adafruit_FONA fona = Adafruit_FONA(FONA_RST);
/*
The example indicates that you should uncomment Serial1 if using HardwareSerial. No need for that.
Next, update Adafruit_FONA.cpp to include HWSerial for the Teensy by putting this at the top:
*/
#if (ARDUINO >= 100)
#include "Arduino.h"
#ifdef SERIAL_PORT_USBVIRTUAL
#include <HardwareSerial.h>
#else
#include <SoftwareSerial.h>
#endif
#else
#include "WProgram.h"
#include <NewSoftSerial.h>
#endif
/*
Lastly, update Adafruit_FONA.h with the same as above. That's it...
*/
@zacstewart
Copy link

zacstewart commented Jun 2, 2019

I figured it out! I had TX on the Teensy connected to TX on the FONA and same with RX. I just flipped them and it fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment