There is always a zero in the buffer

Hi there!

I'm new using arduino so I've begun with simple sketches like this:

int number;
void setup() {


void loop() {
      Serial.println("Number is equal to 23");
    }else if(numero>23){
      Serial.println("Number is more than 23");
      Serial.println("Number is less than 23");


If you write a number in the serial monitor, the code compares to 23 and shows the result correctly but right after appears:

0 Number is less than 23

I've tried with other sketches and it always happens when using if(Serial.available()>0). It seems to me as if there was always a zero value in the buffer.. but I'm not an expert at all.

Any help is welcome, thanks.

In the serial monitor, at the bottom, try setting the line ending to “No line ending”.

I see you changed “numero” to “number”, but missed a couple. :slight_smile:
(You’ll get a compile error with the code as shown.)

Hi OldSteve!

Thank you very much! :) Now it works. I didn't know anything about that part of the Serial Monitor , so I've looked for some information and it makes sense!

Yes, you are right I missed two "numero" :blush: . I just translated from spanish in the post, but the code in my computer is all in the same language :D .

Irenuka: Hi OldSteve! Thank you very much! :) Now it works.

No problem. Glad to help. :)