grove.button.button_gpio

This is the code for GPIO Button event detection.

Classes

class grove.button.button_gpio.ButtonTypedGpio(pin, low_pressed=True)[source]

GPIO Button Class

provide event checking ability to derived class, should not use directly by end-user. The checking events include:

  • Button.EV_SINGLE_CLICK

  • Button.EV_DOUBLE_CLICK

  • Button.EV_LONG_PRESS

  • Button.EV_LEVEL_CHANGED

Parameters:
  • pin (int) – GPIO pin number the button connected.

  • low_pressed (bool) –

    optional, default True

    True if the the button gpio level is low when pressed.

    False if level high when pressed

Inheritance

digraph inheritanceb602b86845 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "Button" [URL="grove.button.button.html#grove.button.button.Button",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Button Base Class"]; "ButtonTypedGpio" [URL="#grove.button.button_gpio.ButtonTypedGpio",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="GPIO Button Class"]; "Button" -> "ButtonTypedGpio" [arrowsize=0.5,style="setlinewidth(0.5)"]; }
is_pressed(index=0)[source]

Get the button status if it’s being pressed ?

Parameters:

index (int) – optional, the arg index not be used.

Returns:

True if the button is being pressed.

False if not.

Return type:

(bool)