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 has contributed to dozens of enterprise Node.js services and has worked for a company dedicated to securing Node.js. He has spoken at several conferences on Node.js and JavaScript, published a book on microservices, and is an organizer of Nodeschool SF.