Sale!

Assignment #5 – Lighting System with I2C Memory

$35.00

Category:
5/5 - (2 votes)

Assignment #5 – Lighting System with I2C Memory
Construct the circuit shown below:
Your program should allow the user to adjust the brightness of LED1 and LED2 using the four
switches. Pressing “L1up” should increase the brightness of LED1, pressing “L1down” should decrease
the brightness of LED1. Likewise, pressing “L2up” should increase the brightness of LED2, pressing
“L2down” should decrease the brightness of LED2. The brightness of the LEDs should be adjusted by
changing the duty cycle of the LEDs from 0% to 100% in steps of 20% per press.
The I2C EEPROM (24LC01 or 24AA01) should be used to store the selected brightness level of both
LEDs so that the last selected brightness will always be restored as the initial default whenever the
program starts. If the contents of the EEPROM are not valid (for example, the EEPROM is blank or has
been somehow corrupted), both LEDs should default to 100% brightness. Note that although the
EEPROM can be rewritten over 1 million times, this can been exceeded if constantly written to for a
few hours; to avoid premature failure, only update the EEPROM when the brightness level is changed.
Submit your “main.cpp” to the appropriate dropbox on Canvas by the end of April 22nd.
VOUT
p23
p24
p10
p9
GND
L1up
mbed
L1down
p21
p22
L2up
L2down
SDA
SCL
WP
VCC
VSS
A0
A1
A2
24×01
2.2 k
2.2 k
1
2
3
4 5
6
7
8

Scroll to Top