Project 1 - Interfacing a 16*2 LCD with Arduino using I2C protocol
Project 1 - Interfacing a 16*2 LCD with Arduino using I2C protocol
in the above we have to use the i2c protocol with the arduno and have to dispaly the signals here were gonna use two aurino boards one is master and the other is slave we have to communicate both and control the data sharing between master to slave and slave to master

here in the above we can see that in the circuit diagram i have took two arduno boards and two bread boards and two lcs and the 4 potentio meters first i connected two arduno boards a4 ,a5 pins parallly together and connected to ground of each other arduno board this works as a i2c protocol potwntio meters used contrast the lcd

here in the code first iu included the liquid crystal .h librairy to allow the functions about the lcd and used the wire .h to allow the functions about i2c protocol after i mentioned the lcd pins which pins are we using after in void setup first i used the lcd .begin function to initialze the lcd and after cursor set to (0,0)this means o th colum and o th row and after i printed the ramesh and after some delay i set the cursor to (0,1)in theere i again used the anotyher string in the diapay after i initialized the serial moniotor by using the serial .begin and after i initialized the wire.bein to start the i2c protocol
in the void loop first used the fuinction wire .request from means it request the data from the slave in the next line i read the data from slave by using wire .read now w are going to transmit the data from masrter toi slave for that i used the analog read function to read the values from the potentio meter and i convert that values into 8 bit and after send it to the slave by using the wire ,transdmission and wire .write and end the trnamissioon commands and after in the lcd display what ever i read the data from the slave i used to dispolay in the lcd


above code is for the slave i used the same commands in variab;le declarations part and void set up here what ever i used the master code but in the void set up at last i used the functions master wire.on receive and wire .on request to recieve the data from the master and to send the data to master in the void loop i jusrt written the commands abouut the lcd function after in wire.on receive function i used tghe command wire.read it means im rading the data from tghe master sending after iin the wire.on request event funtion im the reading the analog values in the slave funbction and after convert it into 8 bit and after send it to the master by using wire .write command

here we can observe in the abpove picture that we are chganging the values in the potentio meter in the slave circuit and we can observe the can be displayed in the master side lcd the above first one is the master lcd the firast arduno board ios the master arduno board

here we can obnserve in the above pictyure we are changing the valuies in the piotentio meter master side we can observe the values diplatyed on the slave side lcd here the second one lcd is the slave and the second one arduno is the slave