Can't directly write 0 over serial


Recommended Posts

I'm currently trying to work with a device that expects specific values to be sent to it over serial. When I try to send a value of 0 over serial I get the error "call of overloaded 'write(int)' is ambiguous". An example of this is below:

void setup(){  Serial.begin(9600);}void loop(){  Serial.write(0);}

On the other hand, when I set a variable to 0 and then write that variable out over serial it sends the value out without a problem. An example of the working variant is here:

int number;void setup(){  Serial.begin(9600);  number = 0;}void loop(){  Serial.write(number);}

It's also worth noting that it seems to also do this in the actual Arduino IDE in addition to ZAP.

Is this functioning as intended or is this a bug?

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.