title: Serial available always returns 0 in Arduino
body: <p>Why do I keep getting 0? I tried several ways and took the sample code on the Arduino site, but that didn’t work either. I always get <code>Serial.available() = 0</code>.</p>
  <pre><code>int incomingByte = 0;  // For incoming serial data
  
  void setup() {
      Serial.begin(9600);  // Opens serial port, sets data rate to 9600 bit/s
  }
  
  void loop() {
  
      // Send data only when you receive data:
      if (Serial.available() &gt; 0) {
          // Read the incoming byte:
          incomingByte = Serial.read();
  
          // Say what you got:
          Serial.print(&quot;I received: &quot;);
          Serial.println(incomingByte, DEC);
      }
      else
          Serial.print(&quot;I received nothing &quot;);
  }
  </code></pre>