system
November 6, 2013, 8:16pm
1
Hello guys. I need help with the TinyGPS library. How can i take the directions of my arduino with just the TinyGPS library and display them on an LCD?
I found this in the TInyGPS library:
const char TinyGPS::cardinal (float course)
{
static const char directions[] = {"N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE", "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"};
int direction = (int)((course + 11.25f) / 22.5f);
return directions[direction % 16];
I want to display the direction the arduino is heading on the display. I have an arduino UNO , LCD4884, ublox gps H-8123.
How can I do that? :~ I appreciate a lot if you help me
Thank you.
(Sorry for my English)
system
November 6, 2013, 8:23pm
2
I want to display the direction the arduino is heading on the display.
lcd.print (myGPS.cardinal (currentCourse));
?
system
November 6, 2013, 8:47pm
3
AWOL:
I want to display the direction the arduino is heading on the display.
lcd.print (myGPS.cardinal (currentCourse));
?
Thank you for your answer.
gps.get_position(&lat, &lon, &fix_age);
sprintf(buf, (TinyGPS::cardinal));
I get this error:
sketch_oct18a.ino: In function 'void loop()':
sketch_oct18a:176: error: cannot convert 'const char* ()(float)' to 'const char ' for argument '2' to 'int sprintf(char*, const char*, ...)'
Have I wrote it correct?
system
November 6, 2013, 9:03pm
4
Have I wrote it correct?
The compiler has already told you the answer to that question.
sprintf_P(buf, "%s", myGPS.cardinal(myCourse));
But if you're going to send it to the LCD anyway, the example I gave earlier should be just as good.
system
November 6, 2013, 10:07pm
5
AWOL:
Have I wrote it correct?
The compiler has already told you the answer to that question.
sprintf_P(buf, "%s", myGPS.cardinal(myCourse));
But if you're going to send it to the LCD anyway, the example I gave earlier should be just as good.
What i'm suppose to write in (myCourse)? And why we put an %s and not another letter?
Sorry i'm newbie
system
November 6, 2013, 10:23pm
6
What i'm suppose to write in (myCourse)?
Your course.
And why we put an %s and not another letter?
Because we're going to print a string.
What other letter did you have in mind?
system
November 8, 2013, 1:38pm
7
AWOL:
What i'm suppose to write in (myCourse)?
Your course.
And why we put an %s and not another letter?
Because we're going to print a string.
What other letter did you have in mind?
Thank you AWOL i figured out how to do it you help me so much!