Buttons

Library
Stemi provides four already initialized buttons to user code. They can be accessed through the global variable buttons. They correspond to properties A, B, C and D of variable buttons.
button.py
class Button:
def __init__(self, pin):
...
def read(self):
...
def read_int(self):
...
Explanations
| Returns | Description | |
|---|---|---|
__init__ | a Button instance | creates an instance of the button class and sets it up |
read | boolean | returns True if the button is pressed, False otherwise |
read_int | int | returns 1 if the button is pressed, 0 otherwise |
Example
main.py
print(buttons.A.read())
print(buttons.B.read_int())
print(buttons.C.read())
print(buttons.D.read_int())
note
buttons is a global variable that you'll be provided with