aslan0626
Üye
- Katılım
- 24 Nis 2020
- Mesajlar
- 1
- Puanları
- 1
Design the following devices:
1. 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.
2. A serial or parallel slave that has 6 LEDs controlled by PWM. You should send two bytes to control the LEDs, first one would be the index of the LED, second is the PWM value. Store LED states in variables/array. Also, it should be possible to mark an LED to blink. You could set the most significant bit of the first byte to denote it is blinking request (or increase the number of bytes to 3 if you want, first being blink or normal). 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. Hint: check the clock, don't delay.
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).
This assignment is not very difficult if you implement and test it part by part. Do not try to attempt doing it all at once. Submit a link to Tinkercad directly as a response to this assignment if you use it. Otherwise submit code and pictures if you have enough materials to build this device.
1. 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.
2. A serial or parallel slave that has 6 LEDs controlled by PWM. You should send two bytes to control the LEDs, first one would be the index of the LED, second is the PWM value. Store LED states in variables/array. Also, it should be possible to mark an LED to blink. You could set the most significant bit of the first byte to denote it is blinking request (or increase the number of bytes to 3 if you want, first being blink or normal). 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. Hint: check the clock, don't delay.
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).
This assignment is not very difficult if you implement and test it part by part. Do not try to attempt doing it all at once. Submit a link to Tinkercad directly as a response to this assignment if you use it. Otherwise submit code and pictures if you have enough materials to build this device.