Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # SET INITIAL COUNT FOR DISPLAY BOARD MENU CODE
- count = 1
- def menu():
- global count
- while 1:
- time.sleep(0.01)
- if GPIO.input(switch): #If button clicked
- if count == 1: #maybe each count can go to its own function?
- #bus.write_byte_data(addr, 0x13, 7) #do we need this line?
- bus.write_byte_data(addr, 0x12, N1) #Show number 1 on display
- time.sleep(1) # wait for second press ## perhaps we can just use a second button here for ease?
- if GPIO.input(switch): #IF STILL HOLDING BUTTON after a second go to function
- # GO TO FUNCTION
- elif not GPIO.input(switch): #if switch no longer being pushed
- count = 2# update count to 2
- menu()# start the menu again ## ANYTHING WRONG WITH DOING THIS?
- if count == 2:
- # same here
- if count == 3:
- # same here
- if count == 4:
- # same here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement