Skip to content
Snippets Groups Projects
Forked from card10 / firmware
1363 commits behind the upstream repository.
buttons.rst 1.31 KiB

buttons - Push Buttons

The :py:mod:`buttons` module allows you to use card10's push buttons as input in your scripts.

Example:

import buttons

print("Press bottom left or right button:")

while True:
   pressed = buttons.read(
       buttons.BOTTOM_LEFT | buttons.BOTTOM_RIGHT
   )

   if pressed != 0:
      break

if pressed & buttons.BOTTOM_LEFT != 0:
   print("Left button pressed!")

if pressed & buttons.BOTTOM_RIGHT != 0:
   print("Right button pressed!")