My First Arduino Project

My First Arduino Project
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.

Tags: #hardware
Thomas Hunter II Avatar

Thomas is the author of Advanced Microservices and is a prolific public speaker with a passion for reducing complex problems into simple language and diagrams. His career includes working at Fortune 50's in the Midwest, co-founding a successful startup, and everything in between.