Lab 01 – Molly

Description:

For this lab, I began with the simple on/off LED example to get used to the Arduino board. After that, I wanted to try putting multiple LEDs into the circuit. I found some examples online that showed me how to initialize the other LEDs into different ports in my Arduino, and how to create loops to run those. I ended up using all three LEDs, and lighting them in order sequentially.
(I had looked to find information on running multiple LEDs at different rates at the same time, but wasn’t able to find anything simple to implement. It seemed like the delay() function allowed other loops to start running? I’d like to explore this more but haven’t yet.)

Components:

  • 1 Arduino Uno
  • 1 breadboard
  • 3 LEDs
  • 3 220Ω resistors
  • jumper wires
  • USB cable
  • computer

Code:
int led1 = 13;
int led2 = 10;
int led3 = 6;

void setup() {
// put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(led1, HIGH);
delay(1000);
digitalWrite(led1, LOW);
delay(100);
digitalWrite(led2, HIGH);
delay(1000);
digitalWrite(led2, LOW);
delay(100);
digitalWrite(led3, HIGH);
delay(1000);
digitalWrite(led3, LOW);
delay(100);
}

Photos:

single LED
IMG_1169

three LEDs
IMG_1172

Leave a Reply