Go Down

Topic: GPS EM-406 interface to PC (Read 1 time) previous topic - next topic

summer

I connect GPS EM-406 to Arduino  duemilanove atmega328 but i have stange output?!!!

ÝÝÝÝÝÝ  

im using Aruino (0018)



my code is

#include <NewSoftSerial.h>
#define rxPin 2
#define txPin 3

NewSoftSerial GPS =  NewSoftSerial(rxPin, txPin);

void setup()
{
 pinMode(rxPin, INPUT);
 pinMode(txPin, OUTPUT);
 GPS.begin(4800);
 Serial.begin(9600);
}
void loop()
{
 char someChar = GPS.read();

 Serial.print(someChar,BYTE);
delay(100);

}

Please if any one have solution replay me.

PaulS

The y with the two dots above it is what you get when you try to print a -1 as a character. The -1 is also what you get when you try to read serial data that isn't there.

The NewSoftSerial class has a method, available(), that tells you how many bytes of data are available to read. Use that method, and don't try to read serial data when none is available.

Or, don't store (or print) the value when it isn't valid.

summer

Could u please give a sample code to do that?

PaulS

Code: [Select]
if(GPS.available() > 0)
{
  char someChar = GPS.read();
  Serial.print(someChar,BYTE);
}

summer


summer

Hi

My Code is the follwoing

NewSoftSerial GPS =  NewSoftSerial(rxPin, txPin);

void setup()
{
 pinMode(rxPin, INPUT);
 pinMode(txPin, OUTPUT);
 GPS.begin(4800);
 Serial.begin(9600);
}
void loop()
{
if(GPS.available() > 0)
{
  char someChar = GPS.read();
  Serial.print(someChar,BYTE);
  delay(100);
}
}

still im not get any data from GPS EM-406

please anybody help me?

PaulS

Why are you calling pinMode for the tx and rx pins? NewSoftSerial takes care of that.

Aside from that, if you are not getting data from the GPS, it is either not connected to the pins you are reading from, is not getting power, is not grounded properly, or is not communicating at the baud rate that you specified.

summer

the buad rate for gps is 4800 from the data sheet, and the buad rate of PC IS 9600, the red led of gps is on (so power is ok). also the ground is ok?!!!

summer

Hi
It is working now :)  I recived the gps data on my Laptop, i want to navigate from waypoint to anathor waypoint, if anyboady can help me with code?

PaulS

Quote
i want to navigate from waypoint to anathor waypoint, if anyboady can help me with code?

The code to do what? To collect the GPS data on the Arduino? To parse the data to determine the location? To input another location? To compute the distance and direction to the new location? To actually move something in that direction?

summer

what i want exactly is the follwoing:
move from point to other point, so i need to calculate the distance between them and the heading angle also, and how i can feed these data to dc motors of the robot?

PaulS: What you've done to make it work? Details please..

Go Up