Navegando por
Etiqueta: I2C

I2C Communication

I2C Communication

In order to communicate through I2C, we have to do two type of programs. We have to create some code for the Master device (PLC in our case), and another piece of code for the Slave devices, such as PLC, or any other device (RTC clock, ADC,…, that has an I2C available port). Master Code: #include <Wire.h> void setup() { Wire.begin(); Serial.begin(9600); delay(500); } void loop() { Serial.println(«Initial»); Wire.requestFrom(2, 1); // request 1 byte from device #2 while(Wire.available()) { char c…

Leer más Leer más