Go Down

Topic: BYTE type definition in Print library (Arduino 1.0) (Read 2031 times) previous topic - next topic

jmgjmg

I ported a sketch from Arduino 0.22 to Arduino 1.0.
My old skecth uses SoftwareSerial and ultimately Print library to write one byte over serial:
 
Code: [Select]
mySerial.print(0x1A,BYTE);

The 1.0 version of Print.h library has removed the definition of BYTE type
 
Code: [Select]
#define BYTE 0
so I got a compilation error. However, the Print library still implements the functionality and I solved the issue replacing BYTE by 0:
 
Code: [Select]
mySerial.print(0x1A,0);

Any idea why it has been removed?


Grumpy_Mike

Yes to be consistant with other classes. you should use Serial.write now where you used Serial.print(n, BYTE) before.


mellis

Also, Serial.write() will work in 0022 / 0023 (and earlier, too, I think) so it shouldn't present compatibility problems to switch.

Go Up