My First Arduino Project

Here’s my first Arduino project. It simply alternates between two LEDs being lit.

int A = 13;
int B = 12;

void setup() {                
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
}

void loop() {
  digitalWrite(A, HIGH);
  digitalWrite(B, LOW);
  delay(1000);
  digitalWrite(A, LOW);
  digitalWrite(B, HIGH);
  delay(1000);
}

Readers familiar with the Arduino will notice that my yellow LED is on pin 13, which has a resistor built in, and the green LED is on pin 12, which does not have one, and may burn out quicker. So pop a resister in there before you run this setup.

Comment

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>