microhope/microhope-doc/prog/usbecho.py
raw| 1 | import avr309, sys |
| 2 | |
| 3 | con = avr309.avrusb() |
| 4 | if con.fd == None: |
| 5 | print ('AVR309 USB to Serial Adapter not found. Exiting') |
| 6 | sys.exit() |
| 7 | |
| 8 | con.setbaud(38) # 38 for 38400 and 12 for 115200 |
| 9 | |
| 10 | while 1: |
| 11 | c = raw_input('Enter a character : ') |
| 12 | con.write(ord(c)) |
| 13 | print (chr(con.read_one())) |