Evolution of a Blog

This blog has evolved as I have as a maker. It starts at the beginning of my journey where I began to re-tread my tires in the useful lore of micro electronics and the open-source software that can drive them. While building solutions around micro-electronics are still an occasional topic my more recent focus has been on the 3D Printing side of making.

Monday, May 6, 2013

Simple Arduino Serial Communications Example

I had done a little serial work with the Arduino and my 'Bot but wanted to try another example.   In this case I have a sketch that  has the Arduino being the  receiver of a one way ASCII data stream.   The data stream uses two sync chars followed by two characters that will make up a two char integer. 

A real implementation would probably use character 127 but I am using "%" for illustrative purposes.  A real implementation would also recognize that the second of two chars of data could be a 127 and therefore you could see two sync characters where one of them is really data.

%%GF%%HG%34%%4%%%HH
   
First payload       - GF
Second payload      - HG
Garbage collected   - %34
Third payload       - 4%
Fourth payload      - HH

%%GF %%HG %34 %%4% %%HH

Here is a link to the sample code.

No comments:

Post a Comment