Would you mind helping me with this issue?
I bought RS232 sheild.When I use it in my project… the message from device over RS232 to Arduino not completely appears..just 63bit while the whole messge is about 120byte.
When I turn on the device The only first message be fully send ,while when send it again it ,the message the partial of it be sent .
Hi.
I never tried using a R232 shield or module before.
But, if you share your code, I might try to take a look..
Regards,
Sara
thank you so much.
this is the part that handle data from RS232 .
void handleRS232Data() {
while (rs232.available()) {
char c = rs232.read();
lastRS232Char = millis();
if ((c >= 32 && c 0) {
Serial.println(“RS232: Received 0 && lastRS232Char > 0) {
if (millis() – lastRS232Char > 200) {
Serial.println(“RS232: Received 250) {
Serial.println(“RS232: Received <- " + rs232Buffer);
Serial.println("WARNING: Buffer overflow protection triggered");
rs232Buffer = "";
lastRS232Char = 0;
}
}
Hi.
Your code seems alright.
Have you tried decreasing the time between characters? For example, 50 instead of 200?
if (millis() – lastRS232Char > 50) {
Since that sensor uses Serial communication, you can take a look at our tutorial and see if there are any tips or sections of code that you can improve based on our examples:
ESP32 UART Communication (Serial): Set Pins, Interfaces, Send and Receive Data (Arduino IDE)
Regards,
Sara