[][src]Struct rust_gpiozero::output_devices::OutputDevice

pub struct OutputDevice { /* fields omitted */ }

Represents a generic GPIO output device.

Methods

impl OutputDevice[src]

pub fn new(pin: u8) -> OutputDevice[src]

Returns an OutputDevice with the pin number given

  • pin - The GPIO pin which the device is attached to

pub fn is_active(&self) -> bool[src]

Returns True if the device is currently active and False otherwise.

pub fn close(self)[src]

Shut down the device and release all associated resources.

pub fn pin(&self) -> u8[src]

The Pin that the device is connected to.

pub fn value(&self) -> bool[src]

Returns True if the device is currently active and False otherwise.

pub fn set_active_high(&mut self, value: bool)[src]

Set the state for active_high

pub fn active_high(&self) -> bool[src]

When True, the value property is True when the device's pin is high. When False the value property is True when the device's pin is low (i.e. the value is inverted). Be warned that changing it will invert value (i.e. changing this property doesn't change the device's pin state - it just changes how that state is interpreted).

pub fn on(&mut self)[src]

Turns the device on.

pub fn off(&mut self)[src]

Turns the device off.

pub fn toggle(&mut self)[src]

Reverse the state of the device. If it's on, turn it off; if it's off, turn it on.

Trait Implementations

impl Debug for OutputDevice[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.