TinyGPS Directions

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 :slight_smile:

Thank you.

(Sorry for my English)

I want to display the direction the arduino is heading on the display.

lcd.print (myGPS.cardinal (currentCourse)); ?

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?

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.

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

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?

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! :slight_smile: