Closed
Description
Description:
When I use all 3 UARTS they will all 3 send data. But I can not receive any data on the 3rd UART. I can read in serial0 and serial 1 but not on serial 2
Sketch:
This is just an code snippet.
String payload = "{";
payload += "\"temperature\":"; payload += desp_temp; payload += ",";
payload += "\"target\":"; payload += target_temp; payload += ",";
payload += "\"wifi\":"; payload += wifi_quality; payload += ",";
payload += "\"actuator\":"; payload += actuator_feedback;
payload += "}";
// ------------------- Testing Code
ModbusSerial.flush();
ModbusSerial.println(payload);
delay(500);
//Read the data on the port
int datalen = ModbusSerial.available();
Serial.println(datalen);
String SerialData;
for (int z = 0; z < datalen; z ++) {
SerialData += (char)ModbusSerial.read();
}
Serial.print("Data from the Modbus Serial Port : ");
Serial.println(SerialData);
//--------------------------
Here is the paython code that is on the other side. Just for a test
# -*- coding: utf-8 -*-
import serial
import traceback
import time
# Define the serial port
ser = serial.Serial('COM5', 9600 , timeout = 15)
ser.parity = serial.PARITY_EVEN
ser.flushInput()
#Set the run flag
run = True
#Run while the flag is set
while run:
try:
serial_line = ser.readline()
ser.flushInput()
print('Serial Data : ' + serial_line)
print('Sending data to the ESP32')
ser.write('Hallo Jaco !! ' + '\r\n')
time.sleep(0.5)
except KeyboardInterrupt:
print "End"
run = False
except:
traceback.print_exc()
Output on the serial monitor
0
Data from the Modbus Serial Port :
0
Data from the Modbus Serial Port :
0
Data from the Modbus Serial Port :
Output on the Python Side
Serial Data : {"temperature":28.44,"target":0.00,"wifi":58,"actuator":30}
Sending data to the ESP32
Serial Data : {"temperature":28.44,"target":0.00,"wifi":50,"actuator":30}
Sending data to the ESP32
Serial Data : {"temperature":28.44,"target":0.00,"wifi":62,"actuator":30}
Metadata
Metadata
Assignees
Labels
No labels