pub struct PWMLED(/* private fields */);Expand description
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§
Source§impl PWMLED
impl PWMLED
Sourcepub fn new(pin: u8) -> PWMLED
pub fn new(pin: u8) -> PWMLED
Returns a PMWLED with the pin number given
pin- The GPIO pin which the device is attached to
Sourcepub fn blink(
&mut self,
on_time: f32,
off_time: f32,
fade_in_time: f32,
fade_out_time: f32,
)
pub fn blink( &mut self, on_time: f32, off_time: f32, fade_in_time: f32, fade_out_time: f32, )
Make the device turn on and off repeatedly
on_time- Number of seconds onoff_time- Number of seconds offfade_in_time- Number of seconds to spend fading infade_out_time- Number of seconds to spend fading out
Sourcepub fn pulse(&mut self, fade_in_time: f32, fade_out_time: f32)
pub fn pulse(&mut self, fade_in_time: f32, fade_out_time: f32)
Make the device fade in and out repeatedly.
fade_in_time- Number of seconds to spend fading infade_out_time- Number of seconds to spend fading out
Sourcepub fn set_value(&mut self, value: f64)
pub fn set_value(&mut self, value: f64)
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.
Sourcepub fn set_blink_count(&mut self, n: i32)
pub fn set_blink_count(&mut self, n: i32)
Set the number of times to blink the device
n- Number of times to blink
Auto Trait Implementations§
impl Freeze for PWMLED
impl !RefUnwindSafe for PWMLED
impl Send for PWMLED
impl Sync for PWMLED
impl Unpin for PWMLED
impl !UnwindSafe for PWMLED
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more