summaryrefslogtreecommitdiff
path: root/EXAMPLES
diff options
context:
space:
mode:
authorStefano Miccoli <stefano.miccoli@polimi.it>2016-04-09 21:03:17 +0200
committerStefano Miccoli <stefano.miccoli@polimi.it>2016-04-09 21:03:17 +0200
commitdc1d244cd806d7b3bf484d06bef386fb28bd2268 (patch)
treece14fa02f0802f01950c6932a5d285e16cbcd057 /EXAMPLES
parent399eb5a3a1906603ecafe84ffc62565a7231554d (diff)
small bug fix for python example
Diffstat (limited to 'EXAMPLES')
-rwxr-xr-xEXAMPLES/Python/GPIO_STATUS/gpio_status.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/EXAMPLES/Python/GPIO_STATUS/gpio_status.py b/EXAMPLES/Python/GPIO_STATUS/gpio_status.py
index 82c022c..9b3bf78 100755
--- a/EXAMPLES/Python/GPIO_STATUS/gpio_status.py
+++ b/EXAMPLES/Python/GPIO_STATUS/gpio_status.py
@@ -3,6 +3,7 @@
import time
import curses
import atexit
+import sys
import pigpio
@@ -17,6 +18,8 @@ def cleanup():
pi.stop()
pi = pigpio.pi()
+if not pi.connected:
+ sys.exit(1)
stdscr = curses.initscr()
curses.noecho()
@@ -43,7 +46,7 @@ while True:
tally = cb[g].tally()
mode = pi.get_mode(g)
- col = (g / 11) * 25
+ col = (g // 11) * 25
row = (g % 11) + 2
stdscr.addstr(row, col, "{:2}".format(g), curses.A_BOLD)