Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def loop():
old_first = False
old_left = False
old_right = False
old_last = False
index = 0
while True:
# POLL BUTTONS
# remember they are inverted
first = not GPIO.input(BUTTON_FIRST)
left = not GPIO.input(BUTTON_LEFT)
right = not GPIO.input(BUTTON_RIGHT)
last = not GPIO.input(BUTTON_LAST)
# REPORT ANY CHANGED BUTTONS
if first != old_first:
print("FIRST=" + str(first))
old_first = first
if left != old_left:
print("LEFT=" + str(left))
old_left = left
if right != old_right:
print("RIGHT=" + str(right))
old_right = right
if last != old_last:
print("LAST=" + str(last))
old_last = last
def loop():
old_first = False
old_left = False
old_right = False
old_last = False
index = 0
while True:
# POLL BUTTONS
# remember they are inverted
first = not GPIO.input(BUTTON_FIRST)
left = not GPIO.input(BUTTON_LEFT)
right = not GPIO.input(BUTTON_RIGHT)
last = not GPIO.input(BUTTON_LAST)
# REPORT ANY CHANGED BUTTONS
if first != old_first:
print("FIRST=" + str(first))
old_first = first
if left != old_left:
print("LEFT=" + str(left))
old_left = left
if right != old_right:
print("RIGHT=" + str(right))
old_right = right
if last != old_last:
print("LAST=" + str(last))
def loop():
old_first = False
old_left = False
old_right = False
old_last = False
index = 0
while True:
# POLL BUTTONS
# remember they are inverted
first = not GPIO.input(BUTTON_FIRST)
left = not GPIO.input(BUTTON_LEFT)
right = not GPIO.input(BUTTON_RIGHT)
last = not GPIO.input(BUTTON_LAST)
# REPORT ANY CHANGED BUTTONS
if first != old_first:
print("FIRST=" + str(first))
old_first = first
if left != old_left:
print("LEFT=" + str(left))
old_left = left
if right != old_right:
print("RIGHT=" + str(right))
old_right = right
if last != old_last:
print("LAST=" + str(last))
old_last = last