Serial.print prints random 255
hey,
i working on mac app control arduino , works if send values 0-63 arduino using following code on arduino:
the print out should read 0-63 reads is:
0
255
1
2
3
4
...
62
63
255
the shorter delay put in more 255 appear. idea on happening?
thanks
-korki
i working on mac app control arduino , works if send values 0-63 arduino using following code on arduino:
code: [select]
void setup() {
serial.begin(2000000);
serial.print("\n\nhello, rebooted\n\n");
}
void loop() {
uint8_t incomingbyte[2];
// send data when receive data:
if (serial.available() > 0) {
for (int = 0; < 2; i+=2){
// read incoming byte:
incomingbyte[i] = serial.read();
incomingbyte[i+1] = serial.read();
}
serial.println(incomingbyte[0], dec);
serial.println(incomingbyte[1], dec);
delaymicroseconds(5000);
}
}the print out should read 0-63 reads is:
0
255
1
2
3
4
...
62
63
255
the shorter delay put in more 255 appear. idea on happening?
thanks
-korki
why have baud rate @ 2000000?
try setting 9600 , see happens....
try setting 9600 , see happens....
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Serial.print prints random 255
arduino
Comments
Post a Comment