ESP8266 I2C Master to Atting85 I2C Slave issue....need help.
Posted: Fri Jan 08, 2016 10:29 am
I am trying to get I2C to work between my ESP12 on a NodeMCU board and a Atting85 slave.
When I run the code I get no response from the Attiny85. It is supposed to send a request to the Attiny85 and then the Attiny85 is supposed to send response. From what I can see I think I have every thing wired up correctly.
Can any one spot any problems in my setup or code?
My setup:
My Code:
I2C Master
I2C Slave (Attiny85)
When I run the code I get no response from the Attiny85. It is supposed to send a request to the Attiny85 and then the Attiny85 is supposed to send response. From what I can see I think I have every thing wired up correctly.
Can any one spot any problems in my setup or code?
My setup:
My Code:
I2C Master
Code: Select all
//I2C Master for NODE MCU
#include <Wire.h>
#define SLAVE_ADDR 0x50
void setup()
{
Wire.begin(0,2); //set GPIO0 and GPIO2 pins
Serial.begin(9600);
Serial.println("");
Serial.println("I2C Test");
}
void loop()
{
Wire.requestFrom(SLAVE_ADDR, 1);
if (Wire.available())
{
byte byteReceived = Wire.read();
Serial.println(byteReceived, DEC);
}
delay (1000);
}
I2C Slave (Attiny85)
Code: Select all
#include "TinyWireS.h"
#define SLAVE_ADDR 0x50
void setup()
{
TinyWireS.begin(SLAVE_ADDR);
TinyWireS.onRequest(requestEvent);
}
void loop()
{
}
void requestEvent()
{
byte byteToSend = 15;
TinyWireS.send(byteToSend);
}