|
Hello Libelium world,
I would like to get and send GPS data with my XBee module but when I run my code I have nothing on the serial monitor. Before I tried the same code but with USB and it works well so I think I have an error in my GPS code but I don't know where. Could you please help me? Thanks in advance.
Best regards.
My code is the following :
---------------------------------------------------------------------------
packetXBee* paq_sent; char aux[200]; int8_t state=0; uint8_t direccion[8]={0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF};
void setup(){ //setup for Serial port //USB.begin(); // setup the GPS module //USB.println("Setting up GPS..."); GPS.ON(); // waiting for GPS is connected to satellites while( !GPS.check() ) delay(1000); //USB.println("Connected"); // Inits the XBee XSC library xbeeZB.init(ZIGBEE,FREQ2_4G,NORMAL); // Powers XBee xbeeZB.ON(); }
void loop(){
paq_sent=(packetXBee*) calloc(1,sizeof(packetXBee)); paq_sent->mode=BROADCAST; paq_sent->MY_known=0; paq_sent->packetID=0x52; paq_sent->opt=0; xbeeZB.hops=0; xbeeZB.setOriginParams(paq_sent,MAC_TYPE);
sprintf(aux,"Time:%s Date:%s Latitude:%s Longitude:%s Altitude:%s Speed:%s Course:%s",GPS.timeGPS,GPS.dateGPS,GPS.latitude,GPS.longitude,GPS.altitude,GPS.speed,GPS.course); xbeeZB.setDestinationParams(paq_sent, direccion, aux, MAC_TYPE, DATA_ABSOLUTE); xbeeZB.sendXBee(paq_sent); free(paq_sent); paq_sent = NULL; delay(1000); // Getting Time /*GPS.getPosition(); USB.println("---------------"); USB.print("Time: "); USB.println(GPS.timeGPS); USB.print("Date: "); USB.println(GPS.dateGPS); USB.print("Latitude: "); USB.println(GPS.latitude); USB.print("Longitude: "); USB.println(GPS.longitude); USB.print("Altitude: "); USB.println(GPS.altitude); USB.print("Speed: "); USB.println(GPS.speed); USB.print("Course: "); USB.println(GPS.course); USB.println("---------------");*/
}
|