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]
impl LED
[src]pub fn new(pin: u8) -> LED
[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 is_lit(&self) -> bool
[src]
pub fn is_lit(&self) -> bool
[src]Returns True if the device is currently active and False otherwise.
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