Last active
December 14, 2015 02:09
-
-
Save cowdinosaur/5011376 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
// This is a comment - anything on a line after "//" is ignored | |
// by the computer. | |
/* This is also a comment - this one can be multi-line, but it | |
must start and end with these characters */ | |
// You must "declare" variables before you use them, | |
// so that the program knows about them. | |
int ledPin1 = 7; | |
int ledPin2 = 8; | |
// The setup() function is a function that will be | |
// called once at the beginning of a program | |
// We usually set up the initial state of the program here | |
void setup(){ | |
// we call the pinMode() function to declare the LED pins | |
// as outputs | |
pinMode(ledPin1,OUTPUT); | |
pinMode(ledPin2,OUTPUT); | |
} | |
// The loop() function will be called in an endless loop | |
// Your main program code will be in here | |
void loop(){ | |
digitalWrite(ledPin1, HIGH); // turn LED1 on | |
digitalWrite(ledPin2, LOW); // turn LED2 of | |
// wait for a quarter second before changing the light | |
delay(250); | |
digitalWrite(ledPin1, LOW); // turn LED1 off | |
digitalWrite(ledPin2, HIGH); // turn LED2 on | |
// wait for a quarter second before changing the light | |
delay(250); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment