ESP + Arduino like a extender (i2c)
Posted: 02 Dec 2018, 23:25
Hi! I want to connect ESP (ESP EASY) with my Arduino by i2c wire.
Now the task is simple, send an command from ESP EASY like this:
http://ip/control?cmd=pcfgpio,4,1
and catch an Wire.onReceive event on Arduino and get data
l2c scan on ESP EASY is working!
i2c connect ESP 8285 (Master) -> Arduino (Slave) is working!
Now the task is simple, send an command from ESP EASY like this:
http://ip/control?cmd=pcfgpio,4,1
and catch an Wire.onReceive event on Arduino and get data
Code: Select all
#include <Wire.h>
void setup()
{
Wire.begin(4);
Wire.onReceive(receiveEvent);
Serial.begin(9600);
Serial.println("Start slave");
}
void loop()
{
......
}
void receiveEvent(int howMany)
{
Serial.print("EVENT!");
c = Wire.read();
....
}
i2c connect ESP 8285 (Master) -> Arduino (Slave) is working!