title: I want to control my motor using an arduino serial monitor
body: <p>I want it to go "forward" if I type "forward" into the Serial Monitor and "Reverse" if I type "Reverse".</p>
  
  <pre><code>String readString;
  int a = 8;
  int b = 7;
  
  void setup() {
    Serial.begin(9600);
    pinMode(a, OUTPUT);
    pinMode(b, OUTPUT);
    Serial.println("Test");
  }
  
  void loop() {
  
    while (Serial.available()) {
      delay(1);  
      if (Serial.available() &gt;0) {
        char c = Serial.read();
        readString += c;
      } 
    }
  
    if (readString.length() &gt;0) {
      if (readString == "forward")
      {
        digitalWrite(a, HIGH);
        digitalWrite(b, LOW);
        delay(5000);
        readString = "";
      }
      readString="";
    } 
  }
  </code></pre>
  
  <p>If my code doesn't really work can anyone show me some simple examples of how to control a motor through the serial monitor please. I have searched on the internet for different examples, but they never seem to work and I cannot work out what I am doing wrong.</p>