Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)
User avatar
By JyotiRajSharma
#62017 Hi,

Your code is based on 8 pin esp8266 or 16 pin esp8266 ??

You have mentioned Pin1 and Pin3 . Are they Gpio1 and Gpio3 pins as per 16 pins ESP8266 ?? If so i will purchase 16 pin esp too because on 8 pins esp8266, i have only gpio0 and gpio2 to use for i2c and no extra gpio pins to be used for RTS and RESET .

Please share your input.
User avatar
By JyotiRajSharma
#62619 ESP8266 Arduiono
GPIO_0 -------A4
GPIO_2 -------A5
//Arduino as slave
#include <Wire.h>

void setup()
{
Serial.begin(9600);
Wire.begin(8); // join i2c bus with address #8
Wire.onRequest(requestEvent); // register event
}

void loop()
{
delay(1000);
requestEvent();
}
void requestEvent()
{
int temp=24 ;
byte barr_temp[2] = { lowByte(temp), highByte(temp)};
Wire.write(barr_temp,2);
}

//ESP8266 as Master side
void setup()
{
Wire.begin(0,2); // I2C Bus 0
}
loop()
{
byte barr[2];
Wire.requestFrom(8, 2);
while(Wire.available())
{
for(int i = 0; i<2; i++){
byte b = Wire.read();
barr[i] = b;
}
}
When check the value of barr[0] and barr[1] on ESP side, it is returning 0 and 255 only. It should return 24 as low byte and 0 as high byte.

Please help me to resolve this.
User avatar
By Eagle5
#70768
JyotiRajSharma wrote:Hi,

Now i am able to get data from arduino slave to esp8266 master i.e esp8266 can read sensor data via i2c from arduino slave.

Can master esp8266 write some data onto i2c and slave arduino read the same ?? This is required to control LED from webserver --->esp8266------->arduino led.


Hi,

Did you getting DTLS working on the esp8266? (I want to use it with CoAP ...)