Hi friends! I bought an Elegoo v4 kit, which comes with an Arduino board and an esp32 board with a camera module.
My current goal is to have the esp32 connect to the Wifi, create a web server and then receive HTTP requests, to send some Serial data to the arduino board and make the robot move.
This is the esp32 camera board:
It has a serial connection that goes to...
The arduino shield, and the label on the board says that these are connected to the TXD and RXD, or at least that's what I understand by the label.
The schematics in the documentation for the arduino show me this:
I am not sure if my understanding is correct, but I think that this means that the Serial port in the esp32 is connected to the RX and TX pins in the arduino, which I believe are ports 0 and 1, as per the labels on the side of the board:
So I have the following code in my esp32:
// Ping
unsigned long lastPingTime = 0;
const unsigned long pingInterval = 5000; // How many milliseconds to wait for each ping
void setup()
{
Serial.begin(9600);
// ... stuff related to camera server
delay(100);
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
// ...stuff related to web server
}
void loop()
{
if (millis() - lastPingTime >= pingInterval) {
Serial.println("camera ping: Serial1");
lastPingTime = millis();
}
}
I can upload this program and as long as the esp32 is connected to the laptop, I can see the "camera ping" messages every 5 seconds.
Now, I want to be able to capture those messages on the Arduino, so I try to take the first example from this: Serial Input Basics - updated - #4 by Robin2
char receivedChar;
boolean newData = false;
void loop() {
recvOneChar();
showNewData();
}
void recvOneChar() {
if (Serial.available() > 0) {
receivedChar = Serial.read();
newData = true;
}
}
void showNewData() {
if (newData == true) {
Serial.print("This just in ... ");
Serial.println(receivedChar);
newData = false;
}
}
I upload this code, and then nothing happens. I can see messages I print via "Serial.print" but I never read any data with the function recvOneChar
.
I was looking in the forum and found this thread: Serial communication between ESP32 and Arduino UNO - #17 by Idahowalker
i can read that one of the responses says that "One cannot use the Uno's pin-0 and pin-1 for serial comms". Is that so? How could I get the data from the esp32 into the arduino, so I can send messages via HTTP request and have the robot move?