Hello there,
I am using my Duemilanove (ATMEGA 328) with IDE v.1.05-r2
I am trying to read my serial buffer and store 12 bytes of data into 3 variables (4 bytes each, converted into single integers. However, the read function is not stopping at the correct length.
Example:
input 123456789012
output:
123456789012
56789012
9012
from the three variables, respectively. If i set the read length to anything other than 4 (i tried 3 and 2), it works fine.
Write a short sketch that just reads the 3 chunks into three character variables and prints them out. If it is not working properly post the full sketch - and please post the sketch within code tags (the # button) rather than quote tags.
You need to declare each of the colours as 5 chars and the last byte must be 0. That's how C/C++ defines strings. At the moment Serial.print has no means of knowing the end of the any of the colour variables.