Go Down

Topic: Multiple byte serial input (Read 669 times) previous topic - next topic

kersny

I have been scrounging the web for a way to send multiple bytes from my PC to my arduino. I need to be able to send a number( number of sensor counts) ranging from 1 to 1,000, or maybe more. I need this data to be usable as if I had said:

volatile int Dists = 65;

on the arduino
(It is volatile because it needs to be used in an interrupt)

Please Help!

Cheater

What program will be doing the sending?

Its easiest to convert the numbers to binary and put a 'marker' between numbers.
For between 1 to 1,000 I'd use a short (two bytes) followed by a null (0x00).

That way its easy for the Arduino to use (one bitshift will combine the two bytes back in to a short in the Arduino) and the protocol is simple.

kersny

I must be able to send data to it from a serial terminal, so it must be something I can type on a standard keyboard. I know binary pretty well, so I could handle that, but I still don't know how to implement it.

Go Up