title: Sending strings over Serial to Arduino
body: <p>I'm currently experimenting with sending a string to my Arduino Yun and trying to get it to reply back depending on what I send it.</p>
  
  <p>I picked up a framework of some code here and have been experimenting with it but apart from the serial monitor displaying 'ready' I can't make it go any further.</p>
  
  <p>The code is:</p>
  
  <pre><code>//declace a String to hold what we're inputting
  String incomingString;
  
  void setup() {
    //initialise Serial communication on 9600 baud
    Serial.begin(9600);
    while(!Serial);
    //delay(4000);
    Serial.println("Ready!");
    // The incoming String built up one byte at a time.
    incomingString = "";
  }
  
  void loop () {
    // Check if there's incoming serial data.
    if (Serial.available() &gt; 0) {
      // Read a byte from the serial buffer.
      char incomingByte = (char)Serial.read();
      incomingString += incomingByte;
  
      // Checks for null termination of the string.
      if (incomingByte == '\0') {
        // ...do something with String...
        if(incomingString == "hello") {
          Serial.println("Hello World!"); 
        }
  
        incomingString = "";
      }
    } 
  }
  </code></pre>
  
  <p>Can anyone point me in the right direction?</p>
  
  <p>Thanks</p>