mirror of https://github.com/joan2937/pigpio
small bug fix for python example
This commit is contained in:
parent
399eb5a3a1
commit
dc1d244cd8
|
@ -3,6 +3,7 @@
|
||||||
import time
|
import time
|
||||||
import curses
|
import curses
|
||||||
import atexit
|
import atexit
|
||||||
|
import sys
|
||||||
|
|
||||||
import pigpio
|
import pigpio
|
||||||
|
|
||||||
|
@ -17,6 +18,8 @@ def cleanup():
|
||||||
pi.stop()
|
pi.stop()
|
||||||
|
|
||||||
pi = pigpio.pi()
|
pi = pigpio.pi()
|
||||||
|
if not pi.connected:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
stdscr = curses.initscr()
|
stdscr = curses.initscr()
|
||||||
curses.noecho()
|
curses.noecho()
|
||||||
|
@ -43,7 +46,7 @@ while True:
|
||||||
tally = cb[g].tally()
|
tally = cb[g].tally()
|
||||||
mode = pi.get_mode(g)
|
mode = pi.get_mode(g)
|
||||||
|
|
||||||
col = (g / 11) * 25
|
col = (g // 11) * 25
|
||||||
row = (g % 11) + 2
|
row = (g % 11) + 2
|
||||||
|
|
||||||
stdscr.addstr(row, col, "{:2}".format(g), curses.A_BOLD)
|
stdscr.addstr(row, col, "{:2}".format(g), curses.A_BOLD)
|
||||||
|
|
Loading…
Reference in New Issue