/* Blink count Type a number from 1-9 into a serial terminal connection and the onboard LED will blink that number of times. */ void setup() { Serial.begin(9600); pinMode(LED_BUILTIN,OUTPUT); } // // main loop // void loop() { char chr; int code; // // check for a char // if (Serial.available()) { // // read, save, and send char // chr = Serial.read(); code = (chr + 0) - 48; if( code > 0 and code <= 9) { Serial.print("You typed: "); Serial.print(code + '\0'); for(int i = 0; i < code; i++) { digitalWrite(LED_BUILTIN, HIGH); delay(300); digitalWrite(LED_BUILTIN, LOW); Serial.print("."); delay(200); } } Serial.println(); } }