TroubleshootingArduino

Beetle communication with GPS NEO6MV2

userHead wawann.leda 2024-05-01 21:42:49 162 Views0 Replies

Hello, I try to connect my GPS NEO with Beetle board, but nothing good…

 

Before that I did the same (same GPS and same code) with an arduino nano and all worked ok.

 

So I suppose the way to connect the GPS with the Beetle is quite different but all my tests didn't succeed. I need your help to explain me what is wrong, and if it exists special parameters..   When the code runs all GPS value are 000000 in monitor display.

 

I also use a Servo into my code and it works fine.

 

See the code:

 

```

#include <TinyGPS.h>
#include <Servo.h>
#include <SoftwareSerial.h>

 

Servo myservo;  // create servo object to control a servo
TinyGPS gps;
SoftwareSerial serial1(0, 1);   // is it good parameter ??

void setup()
{
 //Serial.begin(9600);
 serial1.begin(9600);
 pinMode(0, INPUT);     // do I need PULLUP  ??
 pinMode(1, OUTPUT);
 pinMode(9, OUTPUT);
 
 myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop()
{
 bool newData = false;
 unsigned long chars;
 unsigned short sentences, failed;


 // For one second we parse GPS data and report some key values
 for (unsigned long start = millis(); millis() - start < 1000;)
 {
   while (serial1.available())
   Serial.println("serial1 available");
   {
     char c = serial1.read();
     //Serial.println(analogRead(A0));    // for test
     //char c = analogRead(A0);     // for  test
     //Serial.write(c); // uncomment this line if you want to see the GPS data
     if (gps.encode(c)) // Did a new valid sentence come in?
       newData = true;
   }
 }

 if (newData)
 {
   float flat, flon;
   unsigned long age;
   gps.f_get_position(&flat, &flon, &age);
   Serial.print("LAT=");
   Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
   Serial.print(" LON=");
   Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
   Serial.print(" SAT=");
   Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
   Serial.print(" PREC=");
   Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
   Serial.println("servo job");
 }
 
 float flat, flon;
 unsigned long age;
 gps.f_get_position(&flat, &flon, &age);
 Serial.print("LAT=");
 Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
 Serial.print(" LON=");
 Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);

 gps.stats(&chars, &sentences, &failed);
 Serial.print(" CHARS=");
 Serial.print(chars);
 Serial.print(" SENTENCES=");
 Serial.print(sentences);
 Serial.print(" CSUM ERR=");
 Serial.println(failed);
 if (chars == 0)
   Serial.println("** No characters received from GPS: check wiring **");
}

```

Thank You


Erwann.