Created
March 3, 2013 17:16
-
-
Save jadudm/5077032 to your computer and use it in GitHub Desktop.
Introducing variables on the Arduino.
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
// Turn two LEDs on then off. | |
// Declare variables for later use. | |
int greenLED; | |
int redLED; | |
void setup () { | |
// Assign values to our variables. | |
greenLED = 2; | |
redLED = 4; | |
// Set the LEDs as outputs. | |
pinMode(greenLED, OUTPUT); | |
pinMode(redLED, OUTPUT); | |
} | |
void loop () { | |
// Turn the LEDs on. | |
digitalWrite(greenLED, HIGH); | |
digitalWrite(redLED, HIGH); | |
// Relax, take some time. | |
delay(1000); | |
// Turn the LEDs off. | |
digitalWrite(greenLED, LOW); | |
digitalWrite(redLEDa, LOW); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment