techoverload/button.py

12 lines
276 B
Python
Raw Normal View History

2022-07-17 02:32:14 +00:00
import serial
def main():
ser = serial.Serial('/dev/ttyUSB0') # open serial port
print(ser.name) # check which port was really used
ser.write(b'hello') # write a string
ser.close() # close port
if __name__ == "__main__":
main()