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
Arduino Board
USB Cable
Photoresistor
Piezo Buzzer
Led
Resistors (330 Ohm)
Wires
Breadboard
Tactile Button
This is what the code looks like to achieve this (Figure 1 and 2).


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).




Comments