Question: Hardware: Using the light sensor and a button to control three different LEDs. / / / / / / Problem Statement: Build an Arduino project
Hardware: Using the light sensor and a button to control three different LEDs.
Problem Statement: Build an Arduino project that uses the Light sensor and a button switch
to control three LEDs. If the Light sensor shows dark light the Green LED. If the button
is pushed light the Red LED. If both the Light sensor reads dark and the button is pushed
light the blue LED and play a kHz tone.
Pseudocode Algorithm
create a global integer variable LEDOnTime msec
setup
set pin as input for button with a pullup resistor
set pin as input for Light sensor
set pin as output for Green LED
set pin as output for Red LED
set pin as output for Blue LED
set pin as output for the buzzerspeaker
loop
if Light sensor dark
Turn on Green LED for LEDOntime use variable
if button pushed
Turn on Red LED for LEDOntime use variable
if Light sensor dark && button pushed compound conditional
Turn on Blue LED for LEDOntime use variable
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
