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:
objectA base class for SPIKE buttons.
button_namemust be one ofleft,right,centerorconnect.descis an optional string that will be using when printing aButtonobject.Return
Trueif the button is currently pressed, else returnFalse
Return
Trueif the button was pressed since the device started or the last time this method was called, else returnFalse
Return an
intof the number of button presses. Also resets this counter to zero.
Return
Trueif the button is currently released, else returnFalse
Wait
timeout_msfor the button to be pressed. ReturnTrueif the button was pressed withintimeout_ms, else returnFalse. Iftimeout_msisNonethis will wait for forever.
Wait
timeout_msfor the button to be released. ReturnTrueif the button was released withintimeout_ms, else returnFalse. Iftimeout_msisNonethis will wait for forever.
Wait
timeout_msfor the button to be bumped. ReturnTrueif the button was bumped withintimeout_ms, else returnFalse. Iftimeout_msisNonethis will wait for forever.
Bases:
spikedev.button.Button
Bases:
spikedev.button.Button
Bases:
spikedev.button.Button
Bases:
spikedev.button.Button