Advertisement
otakus

Untitled

Oct 29th, 2012
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import sys, os, serial, threading
  2.  
  3. def monitor():
  4.  
  5. ser = serial.Serial(COMPORT, BAUDRATE, timeout=0)
  6.  
  7. while (1):
  8. line = ser.readline()
  9. if (line != ""):
  10. # print fields
  11. print line[:-1]
  12. # write to file
  13. text_file = open("seriallog.txt", "a")
  14. text_file.write(line)
  15. text_file.close()
  16.  
  17. # do some other things here
  18.  
  19. print "Stop Monitoring"
  20.  
  21. """ -------------------------------------------
  22. MAIN APPLICATION
  23. """
  24.  
  25. print "Start Serial Monitor"
  26. print
  27.  
  28. 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.
  29. BAUDRATE = 115200
  30.  
  31. monitor()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement