Struct rust_gpiozero::output_devices::DigitalOutputDevice [−][src]
pub struct DigitalOutputDevice { /* fields omitted */ }
Represents a generic output device with typical on/off behaviour. Extends behaviour with a blink() method which uses a background thread to handle toggling the device state without further interaction.
Implementations
impl DigitalOutputDevice
[src]
impl DigitalOutputDevice
[src]pub fn new(pin: u8) -> DigitalOutputDevice
[src]
pub fn is_active(&self) -> bool
[src]
pub fn is_active(&self) -> bool
[src]Returns True
if the device is currently active and False
otherwise.
pub fn toggle(&mut self)
[src]
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 active_high(&self) -> bool
[src]
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]
pub fn set_active_high(&mut self, value: bool)
[src]Set the state for active_high
pub fn blink(&mut self, on_time: f32, off_time: f32)
[src]
pub fn blink(&mut self, on_time: f32, off_time: f32)
[src]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 onoff_time
- Number of seconds off
pub fn set_blink_count(&mut self, n: i32)
[src]
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