SoftwareSerial - Can not send 0x00

Hi, sorry if it's a stupid question but I try to send a synchronisation pattern (0x55 0x55 0x00 0x00 0xFF) to one of my board via the SoftwareSerial library (arduino v1.0.3).

I use these lines:
mySerial.write(0x55);
mySerial.write(0x55);
mySerial.write(0x00);
mySerial.write(0x00);
mySerial.write(0x00);
mySerial.write(0xFF);

At the first "mySerial.write(0x00);" I got this error: call of overloaded 'write(int)' is ambiguous

Can somebody help?

Thx

mySerial.write( (uint8_t) 0x00 );

...or...

mySerial.write( (byte) 0x00 );

If you're feeling especially verbose...

const uint8_t ZeroByte = 0x00;
mySerial.write( ZeroByte );

Why is this only a problem for the 0x00 , and not a problem for the 0x55 ?

And wouldn't it be easier to put this sequence into some kind of string or array or even a loop, rather
than waste code space with 5 calls to the same function ?

Thx Coding Badly, it's working perfectly now.

Yes, why do 0x55 & 0xFF get interpreted as bytes, while 0x00 gets interpreted as an int?

creating a variable:
const byte ZeroByte = 0;

and then using that seems simple enough:

mySerial.write(0x55);
mySerial.write(0x55);
mySerial.write(ZeroByte);
mySerial.write(ZeroByte);
mySerial.write(ZeroByte);
mySerial.write(0xFF);

michinyon:
Why is this only a problem for the 0x00 , and not a problem for the 0x55 ?

And wouldn’t it be easier to put this sequence into some kind of string or array or even a loop, rather than waste code space with 5 calls to the same function ?

It’s only a “waste” if the amount of Flash available is approaching or has surpassed zero.

CrossRoads:
Yes, why do 0x55 & 0xFF get interpreted as bytes, while 0x00 gets interpreted as an int?

See the link above.

creating a variable ... const byte ZeroByte = 0; ... and then using that seems simple enough:

I like it more than the typecast.

Interesting.

maomao:
Can somebody help?

It would IMO be cleaner, as well as resolving your problem, to put the byte sequence into a const byte array and make one call to Serial.write() to send the array.