0
Offline
Newbie
Karma: 0
Posts: 21
Arduino rocks
|
 |
« on: May 20, 2010, 05:44:54 pm » |
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
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #1 on: May 20, 2010, 06:15:17 pm » |
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
Newbie
Karma: 0
Posts: 21
Arduino rocks
|
 |
« Reply #2 on: May 20, 2010, 06:26:56 pm » |
Could u please give a sample code to do that?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #3 on: May 20, 2010, 06:38:56 pm » |
if(GPS.available() > 0) { char someChar = GPS.read(); Serial.print(someChar,BYTE); }
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 21
Arduino rocks
|
 |
« Reply #4 on: May 20, 2010, 06:42:56 pm » |
Thank you, i will try it.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 21
Arduino rocks
|
 |
« Reply #5 on: May 29, 2010, 03:37:36 pm » |
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
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #6 on: May 29, 2010, 03:57:20 pm » |
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
Newbie
Karma: 0
Posts: 21
Arduino rocks
|
 |
« Reply #7 on: May 29, 2010, 04:06:36 pm » |
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
Newbie
Karma: 0
Posts: 21
Arduino rocks
|
 |
« Reply #8 on: June 02, 2010, 02:17:36 pm » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #9 on: June 03, 2010, 05:38:50 am » |
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
Newbie
Karma: 0
Posts: 21
Arduino rocks
|
 |
« Reply #10 on: June 04, 2010, 01:29:00 pm » |
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
Newbie
Karma: 0
Posts: 39
|
 |
« Reply #11 on: July 29, 2010, 08:49:15 pm » |
PaulS: What you've done to make it work? Details please..
|
|
|
|
|
Logged
|
|
|
|
|
|