I have bough an “ARDUINO MEGA 2560 REV3” and the “ADAFRUIT ULTIMATE GPS LOGGER SHIELD PARA ARDUINO”.
and im trying this code
#include <Adafruit_GPS.h>
#include <SPI.h>
#ifdef __AVR__
#include <SoftwareSerial.h>
#endif
#define GPS_ECHO true
#define mySerial Serial1
#define ledPin 13
Adafruit_GPS GPS(&mySerial);
void loop()
{
if (GPS.newNMEAreceived())
{
Serial.println(GPS.lastNMEA());
if (!GPS.parse(GPS.lastNMEA())) //this also sets the newNMEAreceived() flag to false
return;
//this is only to see if this code if being useful
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}
Serial.println("done");
}
The gps switch is in software serial.
Why can not get a gps data with this code? and what I have to do get it? and
can some tell me how to use the hardwareserial and if a have to do some connection in the board.
Adafruits says:
Soft Serial connection works on Uno/Duemilanove/Dicemila Arduinos as well as Leonardos. It does not work on Mega as the Mega does not have Soft Serial suppotr on pins 7 and 8.
but if a run a empty sketch (just with setup and loop functions) and the switch in direct mode, I can see the gps data through the serial com.
For that motive I want to now how can I get this data, I dont care whether is in direct mode.
In the manual I only see the explanation for the leonards board, that says that comment some lines in the setup function and modifying the pint 3 and 2 to 8 and 7.
Can you tell me what modifications I have to do to get working with the arduino mega?
other question.
if the sofware serial if most useful for debbuging, how can I get the data in direct connect and work with them?
The direct connect is 'like' for the final product, does it?