diff --git a/Make_It_Sense/cpx-buttons.py b/Make_It_Sense/cpx-buttons.py new file mode 100644 index 000000000..3bafcef4b --- /dev/null +++ b/Make_It_Sense/cpx-buttons.py @@ -0,0 +1,19 @@ +from digitalio import DigitalInOut, Pull, Direction +import board + +button_a = DigitalInOut(board.BUTTON_A) +button_a.direction = Direction.INPUT +button_a.pull = Pull.DOWN + +button_b = DigitalInOut(board.BUTTON_B) +button_b.direction = Direction.INPUT +button_b.pull = Pull.DOWN + +switch = DigitalInOut(board.SLIDE_SWITCH) +switch.direction = Direction.INPUT +switch.pull = Pull.UP + +# Get the values of the switches now +last_buttona = button_a.value +last_buttonb = button_b.value +last_switch = switch.value