1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-01 03:47:23 +03:00

Committing individual examples instead of one .zip

This commit is contained in:
David A. Mellis
2006-04-26 11:09:43 +00:00
parent 9dbfe53224
commit 260c5d5ee1
39 changed files with 2057 additions and 16 deletions

View File

@ -0,0 +1,24 @@
/* Blink when Digital Read
* ------------------------
*/
int ledPin = 13; // choose the pin for the LED
int inPin = 7; // choose the input pin (for a pushbutton)
int val = 0; // variable for reading the pin status
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inPin, INPUT); // declare pushbutton as input
}
void loop(){
val = digitalRead(inPin); // read input value
if (val == HIGH) { // check if the input is HIGH (button released)
digitalWrite(ledPin, LOW); // turn LED OFF
} else {
digitalWrite(ledPin, HIGH); // blink the LED and go OFF
delay(200);
digitalWrite(ledPin, LOW);
delay(1000);
}
}