GPS-Tracker mit Adafruit Ultimate GPS breakout und 128x54 OLED
Hi ich möchte mir ein GPS Device wie folgt bauen:
Der veröffentliche Code von Ihm läuft bei mir gar nicht meißtens ist da OLED nur schwarz oder zeigt nur 0:0.
Also versuchte ich mich selbst daran. Aber das OLED alleine zu programmieren klappt soweit aber sobald ich versuche das GPS Modul mit einzubinden in den code macht es zicken.
Entweder zeigt es gar nichts an oder nur das adafruit logo. Ich hatte es auch das wenn ich zb anstatt "no GPS" "no Gps Signal" ausgeben wollte es nicht mehr ging bei genau gleichem code.
Bei meinem aktuellen code habe ich drei leds mit eingebaut um zu sehen wo sich das Programm aktuell befindet. Bisher habe ich im Prinzip nur die beispiele von adafruit für das OLED und GPS zusammen in ein Programm gepackt. Aber das OLED bleibt einfach schwarz.
Wäre super wenn mir da weiterhelfen könnte mir fehlt auch noch etwas das Verständnis für die Interrupt Geschichte bei dem GPS modul.
//setupGPS
GPS.begin(9600);
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA); // uncomment this line to turn on RMC (recommended minimum) and GGA (fix data) including altitude
//GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCONLY); // uncomment this line to turn on only the "minimum recommended" data
// For parsing data, we don't suggest using anything but either RMC only or RMC+GGA since
// the parser doesn't care about other sentences at this time
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_10HZ); // 1 Hz update rate
// For the parsing code to work nicely and have time to sort thru the data, and
// print it out we don't suggest using anything higher than 1 Hz
useInterrupt(true);
delay(1000);
// Ask for firmware version
mySerial.println(PMTK_Q_RELEASE);
// Interrupt is called once a millisecond, looks for any new GPS data, and stores it
SIGNAL(TIMER0_COMPA_vect) {
char c = GPS.read();
// if you want to debug, this is a good time to do it!
#ifdef UDR0
if (GPSECHO)
if (c) UDR0 = c;
// writing direct to UDR0 is much much faster than Serial.print
// but only one character can be written at a time.
#endif
}
void useInterrupt(boolean v) {
if (v) {
// Timer0 is already used for millis() - we'll just interrupt somewhere
// in the middle and call the "Compare A" function above
OCR0A = 0xAF;
TIMSK0 |= _BV(OCIE0A);
usingInterrupt = true;
}
else {
// do not call the interrupt function COMPA anymore
TIMSK0 &= ~_BV(OCIE0A);
usingInterrupt = false;
}
}
// in case you are not using the interrupt above, you'll
// need to 'hand query' the GPS, not suggested :(
if (! usingInterrupt) {
// read data from the GPS in the 'main loop'
char c = GPS.read();
// if you want to debug, this is a good time to do it!
if (GPSECHO)
if (c) Serial.print(c);
}
// if a sentence is received, we can check the checksum, parse it...
if (GPS.newNMEAreceived()) {
// a tricky thing here is if we print the NMEA sentence, or data
// we end up not listening and catching other sentences!
// so be very wary if using OUTPUT_ALLDATA and trytng to print out data
//Serial.println(GPS.lastNMEA()); // this also sets the newNMEAreceived() flag to false
if (!GPS.parse(GPS.lastNMEA())) // this also sets the newNMEAreceived() flag to false
return; // we can fail to parse a sentence in which case we should just wait for another
}
// if millis() or timer wraps around, we'll just reset it
if (timer > millis()) timer = millis();
// approximately every 2 seconds or so, print out the current stats
if (millis() - timer > 2000) {
timer = millis(); // reset the timer
RE: GPS-Tracker mit Adafruit Ultimate GPS breakout und 128x54 OLED
Hi,
sag mal hast du das Problem gelöst? Mir geht es aktuell am Uno genauso. GPS geht alleine , OLED klappt , aber wenn ich alles zusammen bringe, dann erhalte ich keinen Fix mehr und das OLED bleibt hängen .
Ich vermute, dass es ein Problem zwischen SPI und Software Serial ist, bin aber noch zu neu dabei, als dass ich da schon genau durchsteige .