![]() ![]() #include//Library for LCD display function Salve code: #include//Library for I2C Communication functions Serial.println(“Master Value is equal to”) ![]() Int potvalue = analogRead(A0) // Reads analog value from POT (0-5V)īyte MasterSend = map(potvalue,0,1023,0,127) //Convert digital value (0 to 1023) to (0 to 127) Wire.requestFrom(8,1) // request 1 byte from slave Arduino Wire.begin() //Begins I2C communication at pin (A4,A5) Serial.begin(9600) //Begins Serial Communication at 9600 baud rate Lcd.setCursor(0,0) //Sets Cursor at first line of Display LiquidCrystal lcd(2, 3, 4, 5, 6,7 ) //Define LCD Module Pins. Master code: #include//Library for I2C Communication The Arduino code is split in two parts: the master code and the slave code, which run on two different Arduino. VSS to RW (Read/Write) to ground terminal.The connections which are done for both LCDs (master & salve) are given below:.Connect pins A4 and A5 on one master Arduino to similar pins on the slave Arduino.Also, it shows the connection of a 16×2 LCD and virtual terminal with Arduino. The following figure shows the I2C connections between two Arduino boards. This way we can use the same bus to communicate with multiple devices. When addressed only the slave with that particular address will reply back with the information while the others keep quit. ![]() Since there is more than one slave in the bus, the master has to refer to each slave using a different address. At any given time only the master will be able to initiate the communication.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |