Can't directly write 0 over serial


mak237

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.