I am currently trying to to use two different serial ports on my arduino uno that is (2,3) for gsm and (8,9) for gps. I have tried both of this links;
1) arduino-uno-with-multiple-software-serial-devices
2) Two port receive using software serial on Arduino.
But nothing seems to be working. The serial monitor displayed nothing.
UPDATE
I changed the libraries of my gps and serial ports to AltSoftSerial and NeoSWSerial. Although both of them working just fine if I use it in the examples. But when I implement both of the libraries and run the code, there are no results in the serial monitor.
#include <NMEAGPS.h>
#include <GPSport.h>
#include <AltSoftSerial.h>
AltSoftSerial sim900a;
NMEAGPS gps; // This parses the GPS characters
gps_fix fix;
void setup()
{
Serial.begin(9600);
sim900a.begin(9600);
gpsPort.begin(9600);
}
void loop()
{
while (gps.available(gpsPort))
{
fix = gps.read();
if (fix.valid.location)
{
Serial.println();
Serial.print("Latitude= ");
Serial.print(fix.latitude(), 6);
Serial.print(" Longitude= ");
Serial.println(fix.longitude(), 6);
sendData = 1;
}
else
{
sendData = 0;
}
}
if(sendData == 1)
{
//do stuffs
delay(5000);
}
}
P/S: I have already tried listen() method to turn off and on each ports but it doesn't seem to be working as intended. Any helps are welcomed. Thank you.