Screen is a command line serial terminal that comes with mac os. Neil wrote a general file to read out the raw data of the serial's print out both in decimal and hex, it can be used as a general serial reader. The second argument is the baud rate (I think Neil's normal code runs at 115200 baud). It takes in two argument - the first is the port for the usb-serial interface (so the * uses the shell's matching to select anything of the form /dev/tty.usbSOMECRYPTICNUMBER) Since filename.py is a python script, you need to call it with the python interpreter. Otherwise, install the serial by typing in:įrom the folder where term.py is located, try the commandįor example, if the baud rate is 9600, the you could type in "python filename.py /dev/tty.usb* 9600" notice that in Neil's examples for different sensors, some take in only the USB serial port but not the baud rate (baut rate is pre-defined inside the file), in that case, you could just do "python filename.py /dev.usb*" Also check the baud rate, some file has 9600, others have 115200 If serial is installed, there won't be any remind message. To check if your mac has python serial built in, type in "Python" to switch to python shell, then type in: Type "help", "copyright", "credits" or "license" for more information. Run Python code to read out serial output from Mac OX Lion, Windows 7 and Ubuntu
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |