I2C Devices

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. 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

Which class is this homework for?

I’ve deleted your other cross-posts @TAHAHASSAN.

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky “How to use this forum - please read.” post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

1. Build your I2C-Master (The UNO) and I2C-Slave (the NANO) Network as per Fog-1 using I2C Bus; where, Slave has extra connections with a button K1 and a potentiometer POT.


2. Read the attached doc file on I2C Bus Programming and then try to write codes/sketch yourself.

Ch-6(I2C)doc.doc (1.43 MB)

Its for the Microprocessor systems for bs EEE deopartment
and i am using tinkercad for this

Its for the Microprocessor systems for bs EEE deopartment
and i am using tinkercad for this

What type of Microprocessor -- 8085/8086/80286/80386/6028/Z80/Z8000/68000?

Using Arduino UNO and for simulation using Tinkercad

Using Arduino UNO and for simulation using Tinkercad

I have no clue what you desire to do.

Is someone able to write the codes for master and slave sides
i am to build the circuits using tinkercad(website) on arduino uni r3 but i need the code

This is the reference for the Wire library: Arduino - Wire.
Read what the functions do. Have a look at the examples. Try a few things.

Build a circuit in Tinkercad and show us your progress, so we can guide you in the right direction.