Making Things Interactive

January 29, 2008

Blinky Lights!

Filed under: 3: LadyAda Tutorials,Cat Adams — catadams @ 12:14 am

After much grief and to-do (Jet and Lea know my pain), I finally got Arduino to work (as of about an hour ago) and make blinky lights and stuff:

int greenPin = 13;                // LED connected to digital pin 13
int ledPin = 12;

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

void loop()                     // run over and over again
{
digitalWrite(ledPin, HIGH);   // sets the LED on
digitalWrite(greenPin, LOW);
delay(1000);                  // waits for a second
digitalWrite(ledPin, LOW);    // sets the LED off
digitalWrite(greenPin, HIGH);
delay(1000);                  // waits for a second
digitalWrite(ledPin, HIGH);
digitalWrite(greenPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
digitalWrite(greenPin, LOW);
delay(500);
}
Advertisements

1 Comment »

  1. Spill! What did you do to get your laptop working? Others may benefit from what you learned…

    Comment by jet — January 29, 2008 @ 12:26 am | Reply


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

Create a free website or blog at WordPress.com.

%d bloggers like this: