Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys, os, serial, threading
- def monitor():
- ser = serial.Serial(COMPORT, BAUDRATE, timeout=0)
- while (1):
- line = ser.readline()
- if (line != ""):
- # print fields
- print line[:-1]
- # write to file
- text_file = open("seriallog.txt", "a")
- text_file.write(line)
- text_file.close()
- # do some other things here
- print "Stop Monitoring"
- """ -------------------------------------------
- MAIN APPLICATION
- """
- print "Start Serial Monitor"
- print
- COMPORT = 26; #this is the serial port, normally it's what it's in the arduino +1 so com0 on arduino would be comport 1 here.
- BAUDRATE = 115200
- monitor()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement