Serial Communication II

Serial Communication 2 

ASCII     BIN                DEC     HEX    OCT

Õ           11010101     213     D5      325
Õ           11010101     213     D5      325
Õ           11010101     213     D5      325
Õ           11010101     213     D5      325
Õ           11010101     213     D5      325
Õ           11010101     213     D5      325
Õ           11010101     213     D5      325
Õ           11010101     213     D5      325
Õ           11010101     213     D5      325

What does that mean?  it’s the output from my potentiometer, in four formats:

ASCII – the value (0..255) is mapped to the ASCII character table, changing a voltage into a character, in this case a funky O with tilde

BIN – the value in binary.

DEC – decimal value 0..255

HEX – hexadecimal (base 16) 1234567890ABCDEF.  Useful for John Norton and the kernel team ("the people who do their taxes in hex")

OCT – octal (base 8)

Taking the double-potentiometer serial feed into Processing, I get a neat James-Bond intro scene-like ball on a black screen.

 

note: the jumper wire replaces the SPST momentary switch in the instructions, I only have two hands!!

Handshaking is a more elegant solution to the problem of parsing a data feed from a source, compared to taking a delimited string and parsing that which could be subject to a lot of potential problems, like getting an ambiguous character and misreading.  Handshaking is perhaps less efficient, but is a better idea when you can have bidirectional communication.

>>screenshot<<

hello
hello
hello
hello
hello
301,772,0
301,772,0
301,772,0

>>    <<

Handshaking wouldn’t be a good system when you can only send or only receive on each end, so consider the hardware for the application before choosing the method of communication.  Handshaking would be a particularly bad idea for a bug.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s