How do u make an I2C with ESP12e and Arduino pro Mini 3.3V?
Posted: Wed Mar 29, 2017 11:31 am
Hi,
i would like to connect both devices through I2C.
Both are 3.3V.
My Serial Monitor on Arduino Pro Mini is blank. I see only initial welcome text but i dont receive anything from ESP.
What am i missing here?
ESP-12e as Master
Arduino Pro Mini 3.3V
Wiring:
http://imgur.com/a/GQtfo
i would like to connect both devices through I2C.
Both are 3.3V.
My Serial Monitor on Arduino Pro Mini is blank. I see only initial welcome text but i dont receive anything from ESP.
What am i missing here?
ESP-12e as Master
Code: Select all
#include <Wire.h>
#include <ESP8266WiFi.h>
int x = 0;
void setup() {
Wire.begin(2,14);
Serial.begin(115200);
Serial.println("*** MASTER - START ***");
}
void loop() {
Wire.beginTransmission(9); // transmit to device #9
Wire.write("x is "); // sends five bytes
Wire.write(x); // sends one byte
Wire.endTransmission(); // stop transmitting
Serial.println(x);
x++;
delay(500);
}
Arduino Pro Mini 3.3V
Code: Select all
#include <Wire.h>
void setup()
{
Wire.begin(9); // join i2c bus with address #9
Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output
Serial.println("/// Slave - Start ///");
}
void loop()
{
delay(100);
}
void receiveEvent(int howMany)
{
while (1 < Wire.available()) // loop through all but the last
{
char c = Wire.read(); // receive byte as a character
Serial.print(c); // print the character
}
int x = Wire.read(); // receive byte as an integer
Serial.println(x); // print the integer
}
Wiring:
http://imgur.com/a/GQtfo