Struct rust_gpiozero::output_devices::LED[][src]

pub struct LED { /* fields omitted */ }

Represents a light emitting diode (LED)

Example

Connect LED as shown below, with cathode(short leg) connected to GND

          Resistor     LED
 Pin 14 o--/\/\/---->|------o GND

Implementations

impl LED[src]

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

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

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

pub fn on(&self)[src]

Turns the device on.

pub fn off(&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.

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

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

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 set_active_high(&mut self, value: bool)[src]

Set the state for active_high

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

The Pin that the device is connected to.

pub fn close(self)[src]

Shut down the device and release all associated resources.

pub fn wait(&mut self)[src]

Block until background process is done

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

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

Make the device turn on and off repeatedly in the background. Use set_blink_count to set the number of times to blink the device

  • on_time - Number of seconds on
  • off_time - Number of seconds off

Set the number of times to blink the device

  • n - Number of times to blink

Trait Implementations

impl Debug for LED[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !RefUnwindSafe for LED

impl Send for LED

impl Sync for LED

impl Unpin for LED

impl !UnwindSafe for LED

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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

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

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.