pynq.lib.button Module

The pynq.lib.rgbled module is a driver for reading values from onboard push-buttons and waiting for button-triggered events.

class pynq.lib.button.Button(index)[source]

Bases: object

This class controls the onboard push-buttons.

index

int – Index of the push-buttons, starting from 0.

read()[source]

Read the current value of the button.

Returns:Either 1 if the button is pressed or 0 otherwise
Return type:int
wait_for_value(value)[source]

Wait for the button to be pressed or released

Parameters:
  • value (int) – 1 to wait for press or 0 to wait for release
  • function wraps the coroutine form so the asyncio (This) –
  • loop will run until the function returns (event) –
wait_for_value_async(value)[source]

Wait for the button to be pressed or released

Parameters:
  • value (int) – 1 to wait for press or 0 to wait for release
  • function is an asyncio coroutine (This) –