'MATLAB Stream vs. Python
Times ago, I wrote this MATLAB code snippet to write data to a serial object (hardware receiver)
try
fwrite(serialObj, codeDEC, 'uint8', 'async');
pause(0.01);
catch
stopasync(serialObj);
fwrite(serialObj, codeDEC, 'uint8', 'async');
pause(0.01);
end
After initialization,communication opens:
serialObj = serial(COMportR,'BaudRate',57600);
set(serialObj,'InputBufferSize', 2^12);
set(serialObj,'FlowControl','hardware');
set(serialObj,'RequestToSend','on');
fopen(serialObj);
Now, I wanted to bring my MATLAB project to Python, so I wrote this code to connect to my device:
import serial
ser = serial.Serial()
ser.port = COMPortR
ser.baudrate = 57600
ser.open()
but I'm not able to set InputBufferSize, FlowControl and RequestToSend. I couldn't find any solution in the pySerial docs.
Then, in the first snippet can I send bytes data instead of uint8? And how can I set the "async" mode?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
