fork download
  1. # your code goes here
  2. import serial as ser
  3. import time
  4.  
  5. se = ser.Serial('/dev/ttyTHS1',
  6. baudrate = 57600,
  7. bytesize = 8,
  8. parity = 'N',
  9. stopbits = 1)
  10.  
  11. se.write(bytes(128))
  12. se.write(bytes(132))
  13. se.write(bytes(139))
  14. se.write(bytes(2))
  15. se.write(bytes(0))
  16. se.write(bytes(0))
Runtime error #stdin #stdout #stderr 0.17s 23708KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 265, in open
    self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyTHS1'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./prog.py", line 9, in <module>
  File "/usr/lib/python3/dist-packages/serial/serialutil.py", line 240, in __init__
    self.open()
  File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 268, in open
    raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyTHS1: [Errno 2] No such file or directory: '/dev/ttyTHS1'