I was trying to send some data from esp32-cam to Arduino Uno. So I was try this code for Esp32-cam
#include<Wire.h>
int hour=12;
void setup() {
Wire.begin();
Serial.begin(115200);
}
void loop() {
Wire.beginTransmission(9);//9 here is the address of the slave board
Wire.write(hour);//Transfers the value of potentiometer to the slave board
Wire.endTransmission();
Serial.print(hour);
delay(1000);
}
And code for Arduino Uno:
#include<Wire.h>
int hour;
void setup() {
// Begin the Serial at 9600 Baud
Wire.begin(9);
Serial.begin(15200);
Wire.onReceive(receiveEvent);
}
void receiveEvent(int bytes) {
while (0 < Wire.available()) {
hour = Wire.read();
}
}
void loop() {
Serial.print(hour);
delay(1000);
}
But this code not working for me. I also trying some other way. But none of them work.
I don't know what you did wrong, so can't offer anything more, except to ask whether you used level shifters, as required for connecting 5V and 3.3V modules.