relay on 1\n\r relay off 1\n\r reset\n\r relay readall\n\r these all work from within pyserial. however relay writeall ff\n\r does not. relay writeall does work from minicom but not via the serial.write() command. Here is a script I wrote that shows the problem I tried using different speeds, 2400, 9600 115200 but it did not make a difference. The firmware version is 8. ==== PYTHON CODE EXAMPLE showing problem ===== import serial import time s=serial.Serial('/dev/ttyACM0', 15200, timeout=1) s.write('ver\n\r') time.sleep(1) print s.read(25) s.write('reset\n\r') time.sleep(1) print s.read(25) s.write('relay readall\n\r') time.sleep(1) print s.read(25) s.write('relay on 0') time.sleep(1) print s.read(25) s.write('relay readall\n\r') time.sleep(1) print s.read(25) s.write('relay on 2') time.sleep(1) print s.read(25) s.write('relay readall\n\r') time.sleep(1) print s.read(25) s.write('relay writeall cc\n\r') time.sleep(1) print s.read(25) s.write('relay readall\n\r') time.sleep(1) print s.read(25) ======= HERE IS OUT PUT from the script ===== >>> import serial >>> import time >>> >>> s=serial.Serial('/dev/ttyACM0', 15200, timeout=1) >>> s.write('ver\n\r') 5 >>> time.sleep(1) >>> print s.read(25) ver 00000008 > >>> >>> s.write('reset\n\r') 7 >>> time.sleep(1) >>> print s.read(25) reset > >>> >>> s.write('relay readall\n\r') 15 >>> time.sleep(1) >>> print s.read(25) relay readall 00 > >>> >>> s.write('relay on 0') 10 >>> time.sleep(1) >>> print s.read(25) relay on 0 >>> >>> s.write('relay readall\n\r') 15 >>> time.sleep(1) >>> print s.read(25) aelay reada > >>> >>> s.write('relay on 2') 10 >>> time.sleep(1) >>> print s.read(25) relay on 2 >>> >>> s.write('relay readall\n\r') 15 >>> time.sleep(1) >>> print s.read(25) aelay reada > >>> >>> s.write('relay writeall cc\n\r') 19 >>> time.sleep(1) >>> print s.read(25) relay writeall cc > >>> s.write('relay readall\n\r') 15 >>> time.sleep(1) >>> print s.read(25) relay readall 05 > >>> ======== As you can see the readall reports that only relay 2 and 0 are on. when it should have been relay 7,6 and 3,2 You can also see that the readall command response was corrupted for some reason in earlier calls. Please let me know if you have a solution to the writeall, it would be nice to have for the python library I am creating.
Hello @rlegault, There were a couple of minor issues with the script (No \r after relay on/off commands and \r did not work as expected with Python 2.7 ). I have fixed those and the code is working fine now (please see screenshot below on Windows with Python 2.7). Also the corrected code is attached. Thanks, Tom Numato Lab