Design the following devices:
An I2C slave that has a potentiometer and a button. Master should send which one to read. 1 to read potentiometer value between 0-100, 2 to read button state 0 or 1. Then the next byte requested by the master should be that value. Use a global variable to know which value to send.
A serial or parallel slave that has 6 LEDs. You should send two bytes to control the LEDs. Each LED should be controlled by PWM. Store LED states in variables/array. Also, it should be possible to mark an LED to blink. Blinking an LED while listening for data in serial communication is difficult, if you cannot do this skip it. I will make sure that skipping this will not have a significant impact on your grade.
Finally design a master device that will use the I2C slave to get input and use serial/parallel slave to display. The user should be able to select an LED using potentiometer. So if the potentiometer is at 0, first LED should be selected. Selected LED should blink. Then the user could go into adjustment mode. In this mode, LED should stop blinking and potentiometer should control the brightness of the LED. Next click of the button should turn of adjustment mode. And again the selected LED should start blinking. The last value set any of the LED should stay (this should require no extra work).
how to write following codes