Skip to content

Commit

Permalink
Use get_key()
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-wieser committed Jan 24, 2016
1 parent 8953bbb commit 3365a09
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
11 changes: 4 additions & 7 deletions tests/gate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
print led_on, reading.val
time.sleep(0.1)

try:
c = w.keys.get_nowait()
if c == ' ':
led_on = not led_on
led.write(not led_on)
except:
pass
c = w.get_key()
if c == ' ':
led_on = not led_on
led.write(not led_on)
14 changes: 5 additions & 9 deletions tests/odometer_vis.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,8 @@ def to_cv(val):
# print time.time(), odo.val
logwriter.writerow((time.time(),) + odo.val)

try:
c = w.keys.get_nowait()
except Empty:
pass
else:
if c == 'r':
odo.override_position(0, 0, 0)
elif c == 'q':
break
c = w.get_key()
if c == 'r':
odo.override_position(12, 12, np.pi / 8)
elif c == 'q':
break

0 comments on commit 3365a09

Please sign in to comment.