This question is primarily for slash dev, since I know he wrote the code, but I thought I would post it in case anyone else has a similar issue.
I'm trying to rework code from an Uno to a SparkFun Pro Micro. The first step is to rx/tx gps data over serial ports 8 and 9. I chose NeoSWSerial over AltSoftSerial because AltSoftSerial on a micro seems to require ports 5 and 13, and 13 is not available. (If there is an easy way to use AltSoftSerial on 8,9 on a micro that would work fine for me). 8 and 9 seem to be the only ports I can use because other available ports will be used for logging to SD.
In using NewSWSerial, I get the following error when uploading:
Arduino: 1.8.5 (Windows 10), Board: "SparkFun Pro Micro, ATmega32U4 (5V, 16 MHz)"
--snip--
C:\Users\gka\OneDrive\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp: In member function 'void NeoSWSerial::listen()':
C:\Users\gka\OneDrive\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:155:7: error: 'TCCR2A' was not declared in this scope
TCCR2A = 0x00;
^
C:\Users\gka\OneDrive\Documents\Arduino\libraries\NeoSWSerial\src\NeoSWSerial.cpp:156:7: error: 'TCCR2B' was not declared in this scope
TCCR2B = 0x03; // divide by 32
^
Using library NeoSWSerial at version 3.0.5 in folder: C:\Users\gka\OneDrive\Documents\Arduino\libraries\NeoSWSerial
Using library NeoGPS at version 4.2.3 in folder: C:\Users\gka\OneDrive\Documents\Arduino\libraries\NeoGPS
exit status 1
Error compiling for board SparkFun Pro Micro.
The actual code is:
#include <NeoSWSerial.h>
NeoSWSerial gpsPort(8, 9);
#include <NMEAGPS.h>
NMEAGPS gps;
void setup() {
// connect at 115200 so we can read the GPS fast enough and echo without dropping chars
// also spit it out
Serial.begin(115200);
gpsPort.begin( 9600 );
gps.send_P( &gpsPort, F("PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0") ); // RMC_GGA
delay( 100 );
gps.send_P( &gpsPort, F("PMTK220,200") ); // 5Hz
delay( 100 );
gps.send_P( &gpsPort, F("PGCMD,33,0") ); // No antenna status messages needed
delay( 100 );
delay( 5000 );
Serial.println("Ready!");
}
void loop() {
if (gpsPort.available())
Serial.write( gpsPort.read() );
}