spikedev.button¶
A module to interact with the left
, right
, center
and connect
buttons on the SPIKE hub
Example¶
from spikedev.button import ButtonCenter
button = ButtonCenter()
button.wait_for_bump()
print("center button was bumped")
Classes¶
Bases:
object
A base class for SPIKE buttons.
button_name
must be one ofleft
,right
,center
orconnect
.desc
is an optional string that will be using when printing aButton
object.Return
True
if the button is currently pressed, else returnFalse
Return
True
if the button was pressed since the device started or the last time this method was called, else returnFalse
Return an
int
of the number of button presses. Also resets this counter to zero.
Return
True
if the button is currently released, else returnFalse
Wait
timeout_ms
for the button to be pressed. ReturnTrue
if the button was pressed withintimeout_ms
, else returnFalse
. Iftimeout_ms
isNone
this will wait for forever.
Wait
timeout_ms
for the button to be released. ReturnTrue
if the button was released withintimeout_ms
, else returnFalse
. Iftimeout_ms
isNone
this will wait for forever.
Wait
timeout_ms
for the button to be bumped. ReturnTrue
if the button was bumped withintimeout_ms
, else returnFalse
. Iftimeout_ms
isNone
this will wait for forever.
Bases:
spikedev.button.Button
Bases:
spikedev.button.Button
Bases:
spikedev.button.Button
Bases:
spikedev.button.Button