Created
July 28, 2017 20:01
-
-
Save headHUB/46c278b17d148ecb790983b9c6a3e6e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int ledPin = 12; | |
void setup(){ | |
pinMode(ledPin, OUTPUT); | |
Serial.begin(9600); | |
} | |
void loop(){ | |
if (Serial.available()) { | |
light(Serial.read() – ‘0’); | |
} | |
delay(500); | |
} | |
void light(int n){ | |
for (int i = 0; i < n; i++) { | |
digitalWrite(ledPin, HIGH); | |
delay(100); | |
digitalWrite(ledPin, LOW); | |
delay(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment