title: String parsing to extract int in C++ for Arduino
body: <p>I'm trying to write a sketch that allows a user to access data in EEPROM using the serial monitor. In the serial monitor the user should be able to type one of two commands: “read” and “write. "Read" should take one argument, an EEPROM address. "Write" should take two arguments, an EEPROM address and a value. For example, if the user types “read 7” then the contents of EEPROM address 7 should be printed to the serial monitor. If the user types “write 7 12” then the value 12 should be written into address 7 of the EEPROM. Any help is much appreciated. I'm not an expert in Arudino, still learning ;). In the code below I defined inByte to be the serail.read(). Now how do I extract numbers from the string "inByte" to assign to "val" and "addr"</p>
  
  <pre><code>void loop() {
  
  String inByte;
    if (Serial.available() &gt; 0) {
      // get incoming byte:
      inByte = Serial.read();
    }
    if (inByte.startsWith("Write")) {
      EEPROM.write(addr, val);
    }
     if (inByte.startsWith("Read")) {
     val= EEPROM.read(addr);
    }
  
    delay(500);
  }
  </code></pre>