Skip to content

Commit

Permalink
handle closing of application window
Browse files Browse the repository at this point in the history
  • Loading branch information
cbott committed Jan 20, 2017
1 parent 4322d38 commit c310014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion arduinoserial.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ def close(self):
self.ser.close()
self.ser = None
else:
print "No open serial connection"
print "No open serial connection"

5 changes: 4 additions & 1 deletion grapharduino.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

#grapharduino.py
from arduinoserial import Arduino
from liveplots import *
from time import strftime
Expand Down Expand Up @@ -41,6 +41,9 @@ def basic_graph(arduino, log):
log.write(strftime(">> BEGIN LOG << %m/%d/%y at %I:%M %p\n"))
try:
basic_graph(arduino, log)
except BaseException as e:
print(e)
finally:
#run cleanup procedures when application closes
arduino.close()
log.close()

0 comments on commit c310014

Please sign in to comment.