Go Down

Topic: Serial.print(13, BYTE); equivalent command in Arduino 1.0 (Read 17033 times) previous topic - next topic

harindesilva

Serial.print(13, BYTE);

when i write the following instruction i get a compile error message saying that BYTE is no longer supported
what is the equivalent instruction to use in Arduino 1.0

dxw00d

#1
Jan 01, 2012, 01:27 pm Last Edit: Jan 01, 2012, 01:31 pm by dxw00d Reason: 1
The error I get is...

Quote
As of Arduino 1.0, the 'BYTE' keyword is no longer supported.
Please use Serial.write() instead.


so the compiler actually tells you what to use.

Also, reading the release notes http://arduino.cc/en/Main/ReleaseNotes

Quote
* The behavior of Serial.print() on a byte has been changed to align it
 with the other numeric data types. In particular, it will now print
 the digits of its argument as separate ASCII digits (e.g. '1', '2', '3')
 rather than a single byte. The BYTE keyword has been removed. To send a
 single byte of data, use Serial.write() (which is present in Arduino 0022
 as well).

bperrybap

You can use
Code: [Select]
Serial.write(13);

Or
Code: [Select]
Serial.print((char)13);

--- bill

Go Up