Struct rust_gpiozero::input_devices::Button
[−]
[src]
pub struct Button { /* fields omitted */ }
Represents a simple push button or switch. Connect one side of the button to a ground pin, and the other to any GPIO pin
Methods
impl Button
[src]
pub fn new(pin: u64) -> Button
[src]
Create a new Button
pub fn wait_for_press(&self)
[src]
Pause the script until the device is activated
pub fn wait_for_release(&self)
[src]
Pause the script until the device is deactivated
Trait Implementations
impl Device for Button
[src]
fn pin(&self) -> Pin
[src]
Get the pin
fn value(&self) -> i8
[src]
Returns a value representing the device's state.
fn close(&self)
[src]
Shut down the device and release all associated resources.
fn is_active(&self) -> bool
[src]
Returns True
if the device is currently active and False
otherwise.
impl EventsTrait for Button
[src]
fn wait_for_active(&self)
[src]
Pause the program until the device is activated
fn wait_for_inactive(&self)
[src]
Pause the program until the device is deactivated