Created
September 5, 2015 15:08
-
-
Save pixelistik/0095fa245a2af184ec56 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
Blink | |
Turns on an LED on for one second, then off for one second, repeatedly. | |
This example code is in the public domain. | |
*/ | |
int s = 100; | |
int l = 300; | |
int p = 1000; | |
int buttonState; | |
// the setup routine runs once when you press reset: | |
void setup() { | |
// initialize the digital pin as an output. | |
pinMode(13, OUTPUT); | |
// initialise pin 2 as input | |
pinMode(2, INPUT); | |
} | |
// the loop routine runs over and over again forever: | |
void loop() { | |
buttonState = digitalRead(2); | |
if (buttonState == HIGH) { | |
// This happens only when the button is on. | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(s); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(s); // wait for a second | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(s); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(s); | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(s); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(s); | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(l); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(l); // wait for a second | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(l); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(l); | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(l); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(l); | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(s); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(s); // wait for a second | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(s); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(s); | |
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(s); // wait for a second | |
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW | |
delay(s); | |
delay(p); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment