Write an Arduino code that turns the LED on if the light intensity is lower than 100 and turns the LED off if it is higher than 100. The virtual terminal should show the light intensity, read the voltage value at A0, and continuously display the LED status as shown below.
IMPORTANT: Use exactly the same circuit configuration (pin numbers, resistor values, etc).
ARD1
AREF
PB5/SCK PB4/MISO PB3/MOSI/OC2A PB2/OC1B PB1/OC1A PB0/ICP1/CLKO
13 12 11 10 9
D1
LDR1 LDR
-
LED-GREEN
7 6 5 4 3 2 1 0
R2 220
PD7/AIN1 PD7/AIN1 -PD5/T1/OC0B PD4/T0/XCK PD3/INT1/OC2B PD2/INT0 PD1/TXD PD0/RXD
PC5/ADC5/SC
PC4/ADC4
PC3/ADC3
PC2/ADC2
PC1/ADC1
PC0/ADC0
A1 A2 A3 A4 A5
R1 10k
C5/ADC5/SC
oT
Volts
ARDUINO UNO
RXD
TXD
RTS
CTS
The Arduino circuit above consists of the following components:
- An LDR (Light Dependent Resistor) sensor whose resistance value changes with light intensity
- A virtual terminal to monitor the data acquired from the serial port
- A LED
Write an Arduino code that turns the LED on if the light intensity is lower than 100 and turns the LED off if it is higher than 100. The virtual terminal should show the light intensity, read the voltage value at A0, and continuously display the LED status as shown below.