23 lines
599 B
Python
23 lines
599 B
Python
# SPDX-FileCopyrightText: 2018 Anne Barela for Adafruit Industries
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
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
|