Pages: [1]   Go Down
Author Topic: Printing serial inputs to LCD  (Read 409 times)
0 Members and 1 Guest are viewing this topic.
Chicago
Offline Offline
Jr. Member
**
Karma: 1
Posts: 89
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey all, I'm working on a project where I read in data from a UP-501 satellite chip and I want to display the data on an LCD screen. My problem is I don't know how to read data from the serial, save it as a string, parse the information, and print that information to the LCD.

I'm not a very good programmer so if you could please explain everything in detail I would appreciate it.

Data being received:
$GPGGA,114353.000,6016.3245,N,02458.3270,E,1,10,0.81,35.2,M,19.5,M,,*50

My goal is to read in that data through serial, and print out information to the LCD that looks like this:

Long: 6016.3245N
Latt: 02458.3270E
#sat: 10
Logged

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

Quote
My problem is I don't know how to read data from the serial,
Use Serial.available() to know how much data there is. If there is any, use Serial.read to read the next character.

Quote
save it as a string
Define a character array and an index. When you have data to store, store it in the position pointed to by the index and increment the index. Store a NULL ('\0') then. The string should be kept NULL terminated at all times, in my opinion. It MUST be NULL terminated before any string functions are called with it as input.

Quote
parse the information
Use strtok() (not strtok_r()). You may need/want atoi() and/or atof(), too.

Quote
and print that information to the LCD.
Depends on the LCD.

What you want to do is covered by the examples that come with the IDE. It is up to you to understand what each example does, and how to combine them into one usable sketch.
Logged

Pages: [1]   Go Up
Jump to: