I want to send data from my Arduino UNO to esp-32 via serial connection. I connected an Arduino UNO to esp-32 via tx-rx pins. It works fine when the delay()
is greater than or equal to 999
. When it is less than 999
, the value is not transferred to esp-32. Is there any to reduce the delay
time?
Yes, there is a way to reduce the delay time.
Show your code for both the ESP32 and the Uno.
Your topic has been moved to a more suitable location on the forum. Introductory Tutorials is for tutorials that e.g. you write, not for questions. Feel free to write a tutorial once you have solved your problem
how can i reduce it?
can you please provide me any way?
...........................................................................
Help us help you.
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags. Paraphrasing the error message leaves out important information.
Please post a schematic.
Please post an image of your project.
Please describe the problem better then you just did.
......................................................................
If you are using a 9V battery like this.
Don't.
.................................................................
Info about multi things
.......................................................................................................................
I2C scanner
https://www.arduino.cc/reference/en/libraries/i2cscanner/
What did the I2C scanner report?
.........................................................................................
Bread board power rail split
...............................................................................................................................................
Serial Input basics.
................................................................................................................
search box image
.........................................................................................................
disclaimer
The events portrayed in this post are not all true. The names are not real names of real people and real organizations.
..............................................................................
have a look at thread communication-between-esp32-cam-and-arduino-uno
sure, here is my code for arduino uno:
void setup() {
Serial.begin(115200);
}
void loop() {
int val = analogRead(A1);
Serial.println("LDR value: "+ String(val));
delay(999);
}
here is my code for esp-32:
#define RXp2 16
#define TXp2 17
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial2.begin(115200, SERIAL_8N1, RXp2, TXp2);
}
void loop() {
Serial.println("Received value: ");
Serial.println(Serial2.readString());
}
think you need to wait for serial data to arrive, e.g.
void loop() {
if(Serial2.available()) {
Serial.println("Received value: ");
Serial.println(Serial2.readString());
}
}
Same result, not showing any output when delay is less than 999
It happened because the readString()
method waits timeout of 1 second. Do not use it, read the data yourself char by char with read() method
or decrease the timeout by
yeah, this is working, thank you very much
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.