Created
April 8, 2016 02:14
-
-
Save shawngrimes/d20e5a9afc11159cfeba6ade160a04de to your computer and use it in GitHub Desktop.
Simple Arduino Blink example demonstrating the use of a variable to store the pin number for the LED
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
int ledPin=13; //This is a variable to store the pin number that we want the LED on | |
// the setup function runs once when you press reset or power the board | |
void setup() { | |
// initialize digital pin as an output. | |
pinMode(ledPin, OUTPUT); | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(ledPin, HIGH); // turn the LED on (HIGH is the voltage level) | |
delay(1000); // wait for a second | |
digitalWrite(ledPin, LOW); // turn the LED off by making the voltage LOW | |
delay(1000); // wait for a second | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment