# Second value of Serial.println() is always 0

**URL:** <https://forum.arduino.cc/t/second-value-of-serial-println-is-always-0/898395>\
**Category:** Programming\
**Created:** [August 23, 2021, 2:47pm UTC](https://forum.arduino.cc/t/second-value-of-serial-println-is-always-0/898395 "2021-08-23T14:47:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rohith0607](https://avatars.discourse-cdn.com/v4/letter/r/b9e5f3/32.png) [@rohith0607](https://forum.arduino.cc/u/rohith0607)\
**Post date:** [August 23, 2021, 2:47pm UTC](https://forum.arduino.cc/t/second-value-of-serial-println-is-always-0/898395/1 "2021-08-23T14:47:39Z")

</div>

Second value of Serial.println() is always 0, even though I did not enter value 0.

 ![s1](https://europe1.discourse-cdn.com/arduino/original/4X/c/e/e/cee0a76e5b394a73784c1e2d81340e673e2fccbd.jpeg)  
 ![s2](https://europe1.discourse-cdn.com/arduino/original/4X/4/a/7/4a7de5a6d85b09b5e0818dc07e91d61316b558e4.jpeg)

what happening is ...  
when ever I enter a value(eg: 45) in serial monitor, it's printing the value(45) and 0 .  
I don't know why 0 is getting print every time  
Can anyone say why this is happening?  
(I'm new to arduino)

---

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [August 23, 2021, 2:51pm UTC](https://forum.arduino.cc/t/second-value-of-serial-println-is-always-0/898395/2 "2021-08-23T14:51:40Z")

</div>

don't post image of text... just post the text...

likely your issue is due to the newline you send at the end. parseInt() with stop at the new line and then when you come back the Serial buffer is not empty so you proceed and parseInt fails and thus returns 0

I would suggest to study [Serial Input Basics](http://forum.arduino.cc/index.php?topic=396450.0) to handle this

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [August 23, 2021, 2:51pm UTC](https://forum.arduino.cc/t/second-value-of-serial-println-is-always-0/898395/3 "2021-08-23T14:51:46Z")

</div>

What have you got Line ending set to in the Serial monitor ?

Please follow the advice given in the link below when posting code . Use **code tags** when posting code here to make it easier to read and copy for examination

> [@How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966#posting-code):
>
> See also [FAQ - Arduino Forum](https://forum.arduino.cc/faq) for general rules on forum behaviour and etiquette. Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is fru…

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [December 21, 2021, 2:52pm UTC](https://forum.arduino.cc/t/second-value-of-serial-println-is-always-0/898395/4 "2021-12-21T14:52:23Z")

</div>

Closed on December 21, 2021, 2:52pm UTC

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.
