Pages: [1]   Go Down
Author Topic: BYTE type definition in Print library (Arduino 1.0)  (Read 1926 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
mySerial.print(0x1A,BYTE);

The 1.0 version of Print.h library has removed the definition of BYTE type
  
Code:
#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:
mySerial.print(0x1A,0);

 Any idea why it has been removed?

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 639
Posts: 34724
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: