parallax gps module in smart mode with the arduino microcontroller
Javiboo
Posts: 2
Hi, I am trying to use a parallax gps module in smart mode with an arduino microcontroller.
The code I am attempting to use is attached below. My problem is that it isn't returning anything useful.
The computer serial moniter just shows:
!GPS
!GPS
!GPS
!GPS
!GPS
!GPS
Over and over again. Could anyone point out what we are doing wrong? The code below was converted from one that output to an LCD display to one that outputs to the Serial monitor. We have also implemented a diode as suggested here: http://forums.parallax.com/forums/default.aspx?f=15&m=436519
boolean requested = false;
int byteRead = 0;
byte getValid = B00000001;
byte getVersion = B00000000;
byte getTime = B00000011;
byte getDate = B00000100;
//byte getDate = 0x04;
void setup() {
Serial.begin(4800);
}
void loop() {
while (!requested) {
Serial.println("!GPS");
Serial.write(getVersion);
requested = !requested;
}
while (requested) {
while (Serial.available()) {
byteRead = Serial.read();
Serial.print("Received: ");
Serial.println(byteRead, DEC);
delay(1000);
}
requested = !requested;
}
}
The code I am attempting to use is attached below. My problem is that it isn't returning anything useful.
The computer serial moniter just shows:
!GPS
!GPS
!GPS
!GPS
!GPS
!GPS
Over and over again. Could anyone point out what we are doing wrong? The code below was converted from one that output to an LCD display to one that outputs to the Serial monitor. We have also implemented a diode as suggested here: http://forums.parallax.com/forums/default.aspx?f=15&m=436519
boolean requested = false;
int byteRead = 0;
byte getValid = B00000001;
byte getVersion = B00000000;
byte getTime = B00000011;
byte getDate = B00000100;
//byte getDate = 0x04;
void setup() {
Serial.begin(4800);
}
void loop() {
while (!requested) {
Serial.println("!GPS");
Serial.write(getVersion);
requested = !requested;
}
while (requested) {
while (Serial.available()) {
byteRead = Serial.read();
Serial.print("Received: ");
Serial.println(byteRead, DEC);
delay(1000);
}
requested = !requested;
}
}
Comments
If this loop starts where does it ever break out?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
The last line reads "requested = !requested;" which should break the loop because it should turn the boolean requested from true to false.