Struct rust_gpiozero::output_devices::PWMLED[][src]

pub struct PWMLED(_);

Represents a light emitting diode (LED) with variable brightness. A typical configuration of such a device is to connect a GPIO pin to the anode (long leg) of the LED, and the cathode (short leg) to ground, with an optional resistor to prevent the LED from burning out.

Implementations

impl PWMLED[src]

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

Returns a PMWLED with the pin number given

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

Make the device turn on and off repeatedly

  • on_time - Number of seconds on
  • off_time - Number of seconds off
  • fade_in_time - Number of seconds to spend fading in
  • fade_out_time - Number of seconds to spend fading out

pub fn on(&mut self)[src]

Turns the device on.

pub fn off(&mut self)[src]

Turns the device off.

pub fn pulse(&mut self, fade_in_time: f32, fade_out_time: f32)[src]

Make the device fade in and out repeatedly.

  • fade_in_time - Number of seconds to spend fading in
  • fade_out_time - Number of seconds to spend fading out

pub fn set_value(&mut self, value: f64)[src]

Set the duty cycle of the PWM device. 0.0 is off, 1.0 is fully on. Values in between may be specified for varying levels of power in the device.

Set the number of times to blink the device

  • n - Number of times to blink

Auto Trait Implementations

impl !RefUnwindSafe for PWMLED

impl Send for PWMLED

impl Sync for PWMLED

impl Unpin for PWMLED

impl !UnwindSafe for PWMLED

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.