Heidi Wang's Assignment 1: Blink

Requirements

Schematic

schematic for circuit with 3 LEDs

Calculation

calculation for resistance needed for each LED

Circuit

circuit with 3 LEDs

Firmware

link to code file
        
/*
  Blink

  Built with Examples/01.Basics/Blink

  Turns 3 LEDs on for one second, then off for one second, repeatedly, one after another.

  The LEDs are attached to pins 5, 8, and 11.

  modified 1 Oct 2025
  by Heidi Wang
*/

// the setup function runs once when you press reset or power the board
void setup()
{
  // initialize pin 5 as an output
  pinMode(5, OUTPUT);
  // initialize pin 8 as an output
  pinMode(8, OUTPUT);
  // initialize pin 11 as an output
  pinMode(11, OUTPUT);
}

// a helper function to blink the given LED
void blink(int led)
{
  // turn the LED on (HIGH is the voltage level)
  digitalWrite(led, HIGH);
  // wait for a second (1000 milliseconds)
  delay(500);
  // turn the LED off by making the voltage LOW
  digitalWrite(led, LOW);
  // wait for a second (1000 milliseconds)
  delay(200);
}

// the loop function runs over and over again forever
void loop()
{
  // calls the blink function for pin 5
  blink(5);
  // calls the blink function for pin 8
  blink(8);
  // calls the blink function for pin 11
  blink(11);
}
        
      

Operation

Questions

  1. voltage over time for circuit with 3 LEDs
  2. The Arduino Uno R3 has 14 digital I/O pins. If each of them is connected to an LED, then 14 LEDs can be blinked independently. With each LED run at 20mA, 14 LEDs would draw 280mA of current.

  3. The number of LEDs on at a time does not affect how many LEDs can be blinked with this setup. Thus, 14 LEDs is still the max LEDs that can be blinked consecutively.

  4. It is no longer visually apparent that the LEDs are blinking at around 24ms of delay between voltage changes.

  5. No AI use.