Making Things Interactive

January 28, 2008

Lady Ada Tutorials 0-4

Filed under: 3: LadyAda Tutorials — bkish @ 11:38 pm

int redPin = 12; // Red LED connected to digital pin 12
int greenPin = 11; // Green LED connected to digital pin 11
int bluePin = 10; // Blue LED connected to digital pin 10

void setup() // run once, when the sketch starts
{
pinMode(redPin, OUTPUT); // sets the digital pin as output
pinMode(greenPin, OUTPUT); // sets the digital pin as output
pinMode(bluePin, OUTPUT); // sets the digital pin as output
}

void loop() // run over and over again
{
digitalWrite(redPin, HIGH); // sets the Red LED on
delay(4000); // waits for 4 seconds
digitalWrite(greenPin, HIGH); // sets the Green LED on
delay(4000); // waits for 4 seconds
digitalWrite(redPin, LOW); // sets the Red LED off
delay(4000); // waits for 4 seconds
digitalWrite(bluePin, HIGH); // sets the Blue LED off
delay(4000); // waits for 4 seconds
digitalWrite(greenPin, LOW); // sets the Green LED off
digitalWrite(redPin, HIGH); // sets the Red LED on
delay (4000); // waits for 4 seconds
digitalWrite(bluePin, LOW); // sets the Blue LED off

Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: