user23111: I am having troubles with my arduino micro.
In my programming, I am using the serial. When I use println, nothing shows up in the serial monitor except for 0. So if I type 1, I get back 0 instead of 1, same goes for 3241234 or any random number.
Here is the code:
void setup() {
  Serial.begin(9600); //Connect to the serial monitor console
}

void loop() {
    while (Serial.available() == 0); //Wait until Serial is available

    //Read val
    int val = Serial.read() - '0'; //Val that represents input
    delay(500);
    Serial.println(val);
}

So I have another problem and people have asked for the code. Basically, printing a string returns 0.
 void setup() {
  Serial.begin(9600); //Connect to the serial monitor console
}

void loop() {
    while (Serial.available() == 0); //Wait until Serial is available

    //Read val
    int val = Serial.read(); //Val that represents input

    delay(1000);
    if (val == 1) {
      Serial.print('Firing the motor');
    } else {
      Serial.print('Please press 1 to fire the motor.');
    }

    delay(4000);
}

Instead of printing Please press 1 to fire the motor, I get 0 in the console. 
Thanks for the help!

user-1: Try without 
- '0'

You read your data and save into in int. then print that int, when you pass only the int, you get the int as an ASCII-encoded decimal.
Why r u doing
- '0'

?

23111: <p>I am having troubles with my arduino micro.
In my programming, I am using the serial. When I use println, nothing shows up in the serial monitor except for <code>0</code>. So if I type <code>1</code>, I get back <code>0</code> instead of <code>1</code>, same goes for <code>3241234</code> or any random number.
Here is the code:</p>

<pre><code>void setup() {
  Serial.begin(9600); //Connect to the serial monitor console
}

void loop() {
    while (Serial.available() == 0); //Wait until Serial is available

    //Read val
    int val = Serial.read() - '0'; //Val that represents input
    delay(500);
    Serial.println(val);
}
</code></pre>

<p>So I have another problem and people have asked for the code. Basically, printing a string returns 0.</p>

<pre><code> void setup() {
  Serial.begin(9600); //Connect to the serial monitor console
}

void loop() {
    while (Serial.available() == 0); //Wait until Serial is available

    //Read val
    int val = Serial.read(); //Val that represents input

    delay(1000);
    if (val == 1) {
      Serial.print('Firing the motor');
    } else {
      Serial.print('Please press 1 to fire the motor.');
    }

    delay(4000);
}
</code></pre>

<p>Instead of printing Please press 1 to fire the motor, I get 0 in the console. </p>

<p>Thanks for the help!</p>
 -1: <p>Try without </p>

<pre><code>- '0'
</code></pre>

<p>You read your data and save into in int. then print that int, when you pass only the int, you get the int as an ASCII-encoded decimal.
Why r u doing</p>

<pre><code>- '0'
</code></pre>

<p>?</p>
