/* Reading a serial ASCII-encoded string. This sketch demonstrates the Serial parseInt() function. It looks for an ASCII string of comma-separated values. It parses them into ints, and uses those to fade an RGB LED. Circuit: Common-Cathode RGB LED wired like so: * Red anode: digital pin 3 * Green anode: digital pin 5 * Blue anode: digital pin 6 * Cathode : GND created 13 Apr 2012 by Tom Igoe modified 14 Mar 2016 by Arturo Guadalupi This example code is in the public domain. */ void setup() { // initialize serial: Serial.begin(9600); // make the pins outputs: pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, LOW); } void loop() { char inByte = Serial.read(); // read the incoming data if (inByte=='o'){ digitalWrite(LED_BUILTIN, LOW); } else if (inByte=='c'){ digitalWrite(LED_BUILTIN, HIGH); } }