File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 22##You can use this as a start to customize the interface for your needs.
33##NOTE: Change Line 14 to have the proper COM port or it will not work!
44##import serial lib
5- import msvcrt
5+ ## import msvcrt
66import serial
77import io
88import time
99
10+ try :
11+ from msvcrt import getch
12+ except ImportError :
13+ ''' we're not on Windows, so we try the Unix-like approach '''
14+
15+ def getch ( ):
16+ import sys , tty , termios
17+ fd = sys .stdin .fileno ( )
18+ old_settings = termios .tcgetattr (fd )
19+ try :
20+ tty .setraw (fd )
21+ ch = sys .stdin .read (1 )
22+ finally :
23+ termios .tcsetattr (fd , termios .TCSADRAIN , old_settings )
24+ return ch
25+
1026##open serial port
1127print ("Welcome to WDC's 65xx Serial Monitor in Python" );
1228print ("Press the reset button on your board to start reading serial data from the board" );
1329## For now the Serial Port Needs to be set manually. Change the line below to your COMXX port
14- ser = serial .Serial ("COM74 " , 9600 ,timeout = 1 )
30+ ser = serial .Serial ("/dev/tty.usbserial-A703XC1I " , 9600 ,timeout = 1 )
1531ser .flushInput ()
1632ser .flushOutput ()
1733sio = io .TextIOWrapper (io .BufferedRWPair (ser , ser ))
3046 readser = 0
3147 print ("Enter a command. For a list of commands press h" );
3248 print hello ;
33- writedata = msvcrt . getch ()
49+ writedata = getch ()
3450 ser .write (writedata )
3551 readser = 1
3652 elif "BB:AAAA" in hello :
You can’t perform that action at this time.
0 commit comments