[dorkbotpdx-blabber] Just a question re: Dorkboard

Aaron aaron.m.walker at gmail.com
Mon Jan 26 12:25:32 EST 2009


Hello, just got done with the induction yesterday, and playing with my
dorkboard today.

I hooked an additional LED up to pin 12, and am playing with modifying
the little blink program.

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

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  pinMode(ledPin2, OUTPUT);
}

void loop()
{
  digitalWrite(ledPin, HIGH);   // sets the LED on
  digitalWrite(ledPin2, HIGH);   // sets the LED on
  delay(1500);                  // waits for a second
  digitalWrite(ledPin, LOW);    // sets the LED off
  delay(1500);                  // waits for a second
  digitalWrite(ledPin2, LOW);    // sets the LED off
  delay(1500);                  // waits for a second
}

One would expect this would turn on both LEDs, then wait a second,
turn off LED1, wait, turn off LED2, wait, and then turn both on again.
Instead it turns on LED2, waits, turns on LED1, Turns off LED2, turns
off LED1, then repeats. In order to get the behavior I'm wanting, I
had to do this

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

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output
  pinMode(ledPin2, OUTPUT);
}

void loop()
{
  digitalWrite(ledPin, LOW);   // sets the LED on
  digitalWrite(ledPin2, HIGH);   // sets the LED on
  delay(1500);                  // waits for a second
  digitalWrite(ledPin, HIGH);    // sets the LED off
  delay(1500);                  // waits for a second
  digitalWrite(ledPin2, LOW);    // sets the LED off
  delay(1500);                  // waits for a second
}

Is there something wrong with my board? Have I declared something
oddly? Why does 13 being set "high" turn the LED off, and being set
low turn it on?

- Aaron @jarvitron


More information about the dorkbotpdx-blabber mailing list