[−][src]Struct rust_gpiozero::output_devices::PWMOutputDevice
Generic output device configured for software pulse-width modulation (PWM). The pulse width of the signal will be 100μs with a value range of [0,100] (where 0 is a constant low and 100 is a constant high) resulting in a frequenzy of 100 Hz.
Methods
impl PWMOutputDevice
[src]
pub fn new(pin: u8) -> PWMOutputDevice
[src]
Returns a PWMOutputDevice with the pin number given
pin
- The GPIO pin which the device is attached to
pub fn set_value(&mut self, duty: 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.
pub fn set_blink_count(&mut self, n: i32)
[src]
Set the number of times to blink the device
n
- Number of times to blink
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 blink(
&mut self,
on_time: f32,
off_time: f32,
fade_in_time: f32,
fade_out_time: f32
)
[src]
&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
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 infade_out_time
- Number of seconds to spend fading out
Auto Trait Implementations
impl Send for PWMOutputDevice
impl Sync for PWMOutputDevice
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,