Struct rust_rpi_4wd_car::Hids [−][src]
pub struct Hids { /* fields omitted */ }
Proven easier access to audio, visual, and other forms of human interaction with the robot.
Implementations
impl Hids
[src]
pub fn new() -> Rr4cResult<Self>
[src]
Constructor
pub fn beep<S: Into<Option<f64>>>(&mut self, secs: S)
[src]
Used to sound buzzer.
Arguments
secs
- Optional number of seconds to sound buzzer. Defaults to 0.1 seconds. Internally limited between 0.1 and 10 secs.
pub fn blow<S: Into<Option<f64>>>(&mut self, secs: S)
[src]
Turn on the fan motor to blow out flame.
Arguments
secs
- Optional number of seconds to run fan. Defaults to 2 seconds. Internal limits to maximum of 60 seconds.
pub fn key_press(&mut self)
[src]
Waits for the KEY
button on the robot to be pressed.
Filters out noise/debounce the button press.
pub fn lights<R, G, B>(&mut self, red: R, green: G, blue: B) -> Result where
R: Into<Option<u8>>,
G: Into<Option<u8>>,
B: Into<Option<u8>>,
[src]
R: Into<Option<u8>>,
G: Into<Option<u8>>,
B: Into<Option<u8>>,
Used to set all three color LEDs at the same time.
Arguments
red
- Optional brightness for the red LEDs. Seeset_red()
for more info.green
- Optional brightness for the green LEDs. Seeset_green()
for more info.blue
- Optional brightness for the blue LEDs. Seeset_blue()
for more info.
pub fn set_blue<C: Into<Option<u8>>>(&mut self, brightness: C) -> Result
[src]
Sets to brightness of the blue LEDs.
Arguments
brightness
- How brightly the LED should be lit. 0-100(%) range with 50% default ifNone
is used.
Examples
ⓘ
use rust_rpi_4wd_car::{Hids, Result}; use std::{thread::sleep, time::Duration}; fn main() -> Result { let mut hids = Hids::new()?; let pause = Duration::from_millis(50); println!("Varying brightness of LEDs"); for i in (0..100).step_by(10) { hids.set_blue(i)?; sleep(pause); } hids.set_blue(0) }
pub fn set_color<C: Into<u8>>(&mut self, index: C) -> Result
[src]
Set the LEDs to show a color from a preset list of primary and secondary colors.
Arguments
Index
- Index of a color from list which can be found in the constantLED_COLORS
array.
pub fn set_green<C: Into<Option<u8>>>(&mut self, value: C) -> Result
[src]
Sets to brightness of the green LEDs.
Arguments
brightness
- How brightly the LED should be lit. 0-100(%) range with 50% default ifNone
is used.
Examples
ⓘ
use rust_rpi_4wd_car::{Hids, Result}; use std::{thread::sleep, time::Duration}; fn main() -> Result { let mut hids = Hids::new()?; let pause = Duration::from_millis(50); println!("Varying brightness of LEDs"); for i in (0..100).step_by(10) { hids.set_green(i)?; sleep(pause); } hids.set_green(0) }
pub fn set_red<C: Into<Option<u8>>>(&mut self, value: C) -> Result
[src]
Sets to brightness of the red LEDs.
Arguments
brightness
- How brightly the LED should be lit. 0-100(%) range with 50% default ifNone
is used.
Examples
ⓘ
use rust_rpi_4wd_car::{Hids, Result}; use std::{thread::sleep, time::Duration}; fn main() -> Result { let mut hids = Hids::new()?; let pause = Duration::from_millis(50); println!("Varying brightness of LEDs"); for i in (0..100).step_by(10) { hids.set_red(i)?; sleep(pause); } hids.set_red(0) }
pub fn toggle_fan(&mut self) -> Result
[src]
Toggle the fan on/off.
pub fn whistle(&mut self)
[src]
A short bleep from the buzzer.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Hids
impl Send for Hids
impl Sync for Hids
impl Unpin for Hids
impl !UnwindSafe for Hids
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
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]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,