top of page

AT 219 Lab 4 - Arduino Programming Part 2

johnpkeough
Apr 20, 2025
1 min read

This objective of this lab was to create a program in which if it’s dark OR a button is pressed, turn on a light AND play a tune. The parts required for this were

  1. Arduino Board

  2. USB Cable

  3. Photoresistor

  4. Piezo Buzzer

  5. Led

  6. Resistors (330 Ohm)

  7. Wires

  8. Breadboard

  9. Tactile Button


This is what the code looks like to achieve this (Figure 1 and 2).

Figure 1: Code
Figure 1: Code

Figure 2: Code (cont.)
Figure 2: Code (cont.)

The full assembly includes a photoresistor, an LED, a piezo buzzer, and a button (Figure 3). If the button is pressed, or the photoresistor registers a value that constitutes darkness (like covering it with a finger), it will activate the LED and play an ascending C major scale (Figure 4 Video).

Figure 3: Circuit assembly
Figure 3: Circuit assembly



Comments


Contact me

bottom of page