Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import time
- import serial
- # Open port and wait for a reboot
- print "Opening ttyACM0"
- arduino = serial.Serial("/dev/ttyACM0", 9600)
- print "Opened, flushing"
- arduino.flushInput()
- time.sleep(1)
- print "Opening tempfile"
- tempFile = open("/root/lammot.dat", 'w');
- print "tempfile opened"
- print "sending request"
- arduino.write("r")
- ch = -1
- while (ch != 255){
- if arduino.inWaiting():
- print ch
- ch = arduino.read()
- tempFile.write(ch)
- print "Done. closing file and arduino port"
- arduino.close()
- tempFile.close()
- print "Moving temp file and updating graphs"
- os.system("cp /root/lammot.dat /root/arvot.dat")
- os.system("/root/lue_ja_paivita_kuvat")
- os.system("/root/kosteus/lue_ja_paivita_kuvat")
- os.system("/root/valo/lue_ja_paivita_kuvat")
- print "Done. exiting."
Advertisement
Add Comment
Please, Sign In to add comment