Serial.write(0x00) issue. Solved. Doc change suggestion.

I was quite perplexed when I tried to send a null byte (0x00) over the Serial interface. After reading http://arduino.cc/en/Serial/Write I tried Serial.write(0x00); and got this error returned..

call of overloaded 'write(int)' is ambiguous

It turns out that I had to do this... Serial.write((byte)0x00);

This is something that might be nice to add to the reference docs.

acolyte: I was quite perplexed when I tried to send a null byte (0x00) over the Serial interface. After reading http://arduino.cc/en/Serial/Write I tried Serial.write(0x00); and got this error returned..

call of overloaded 'write(int)' is ambiguous

It turns out that I had to do this... Serial.write((byte)0x00);

This is something that might be nice to add to the reference docs.

That problem and that solution has been posted before. It showed up with Arduino IDE release 1.0. I'm pretty sure they have a fix that will be released in the next IDE release in a month or so that casting fix should not be needed there after.

Lefty

I just ran into this today, so its still not fixed on 1.0.1

So what the f is the solution????... Im in this problem now

Serial.write((byte)0x00);

LarryD: Serial.write((byte)0x00);

Good thank you...

But a what to do with others like 1E same? Or can be left like that Serial.write(0x1E);

Why don't you try it?

 Serial.write(0x1E);

See if that works, and then report back to us.

Serial.write(0x1E); works like that Serial.write((byte)0x00); works only like that

Slavka85: So what the f is the solution????... Im in this problem now

What version of the IDE do you have? It seems to compile OK for me under 1.0.6.

[quote author=Nick Gammon link=msg=1977165 date=1417034674] What version of the IDE do you have? It seems to compile OK for me under 1.0.6. [/quote]

1.0.6 ... They saying it will be fixed next IDE. Seems like its happaning like 2 years now... But its ok if here is a solution...

But he was referring to the next version from 1.0.1.

Can you post full code, that demonstrates the problem, which occurs in 1.0.6?

This compiled for me, under 1.0.6 without errors:

void setup ()
  {
  Serial.begin (115200);
  Serial.println ();
  Serial.write (0x00);
  }  // end of setup

void loop () { }