I'm using the GPS Ultimate Shield and an XBEE to develop a base clock and some number of remote units. I'm using one SoftwareSerial for reading the GPS data and another for sending the data to the XBEE. I'm running into a conflict, however. I'm declaring:
SoftwareSerial GPSdata(8,7); // Receive GPS data on pin 8
SoftwareSerial mySerial(2, 3); // Sends data to XBEE on pin 3
LiquidCrystal lcd(4, 5, 9, 10, 11, 12); // Output to LCD
In setup():
lcd.begin(16, 2); // Initialize the LCD display
Serial.begin(19200);
GPSdata.begin (9600); // Receives data from the GPS unit
// mySerial.begin(9600); // set the data rate for the RF link
The program works as expected (on the serial monitor) unless I uncomment the last line. When I do that, the serial monitor remains blank. I understand that there can be a conflict if the Arduino (UNO) receives data on two SoftwareSerial ports at the same time but I'm not sure this is the problem here. The GPS port only receives and the XBEE port only transmits. Can you see what I'm doing wrong?
Thanks,
Dave
GPS Ultimate Shield clock
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: GPS Ultimate Shield clock
Both transmit and receive rely on bit-timing in software, so it's certainly possible for them to interfere with each other (although I think I would expect you to be dropping characters on receive rather than on transmit).
I think your best solution would be to attach the XBee to hardware serial pins 0 and 1, and forget about using the serial monitor.
I think your best solution would be to attach the XBee to hardware serial pins 0 and 1, and forget about using the serial monitor.
- dnorbury
- Posts: 25
- Joined: Sat Aug 17, 2013 12:19 pm
Re: GPS Ultimate Shield clock
Hi Rick,
Thanks for the suggestion. I tried moving the XBEE to pins 0 and 1 but it didn't cure the problem. I finished the part of the program that displayed the time on the LCD and it was blank, the same as the serial monitor when I uncommented the line
// mySerial.begin(9600); // set the data rate for the RF link
The problem remained if I removed the XBEE module from the adapter and even if I unsoldered the XBEE connections! But after trying about everything that made sense to me I decided to move the "mySerial.begin(9600);" statement ahead of the other "begin" statements. Bingo! I now have simultaneously the LCD and the serial monitor working and the XBEE module transmitting as designed. I returned the mySerial connection to pins 2 and 3 so that I have no problem uploading sketch modifications. I don't understand why there was a conflict but this (so far!) seems to have fixed it. Go figure!
Thanks again for your response,
Dave
Thanks for the suggestion. I tried moving the XBEE to pins 0 and 1 but it didn't cure the problem. I finished the part of the program that displayed the time on the LCD and it was blank, the same as the serial monitor when I uncommented the line
// mySerial.begin(9600); // set the data rate for the RF link
The problem remained if I removed the XBEE module from the adapter and even if I unsoldered the XBEE connections! But after trying about everything that made sense to me I decided to move the "mySerial.begin(9600);" statement ahead of the other "begin" statements. Bingo! I now have simultaneously the LCD and the serial monitor working and the XBEE module transmitting as designed. I returned the mySerial connection to pins 2 and 3 so that I have no problem uploading sketch modifications. I don't understand why there was a conflict but this (so far!) seems to have fixed it. Go figure!
Thanks again for your response,
Dave
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: GPS Ultimate Shield clock
'Go figure' is right. It beats me, but you can't argue with success! Congrats
Please be positive and constructive with your questions and comments.