Pages: [1]   Go Down
Author Topic: GPS EM-406 interface to PC  (Read 1204 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could u please give a sample code to do that?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you, i will try it.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?!!!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49365
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Taschereau, Quebec, Canada
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: