Pages: [1]   Go Down
Author Topic: Serial decoding! ints, floats & strings OH My!  (Read 419 times)
0 Members and 1 Guest are viewing this topic.
Summerville, Oregon
Offline Offline
Jr. Member
Karma: 0
Posts: 57
I like this little thing!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have been looking around the playground and here a bit and have not found any libraries for sending complex information over the serial port. An example would be sending a structure, float values or long text strings.  I could write something....used to do something along these lines by separating the data with the pipe symbol.  Probably the simplest example of what I am looking for would be sending an integer. One must convert it to a string, send the string one char at a time, some ending marker and then the receive side must piece it back together again like first char +=, second * 10 += and so on.

I am just being lazy! Seems like such a routine thing that SOMEBODY has to have done this before. Such is the power of open source  smiley-wink


Offline Offline
Tesla Member
Karma: 10
Posts: 6255
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is a simple example of how to send an array of integers as a comma separated string with a cr/lf terminator

const int COUNT = 5;
int values[COUNT] = {3,1,4,1,5};

for(int i=0;i < COUNT; i++)
   if( i < COUNT-1)
« Last Edit: October 17, 2009, 02:10:13 pm by mem » Logged

Pages: [1]   Go Up
Jump to: