pub struct DigitalOutput { /* private fields */ }Expand description
Represents a digital actuator of unspecified type: an Output Device that write digital values
from an OUTPUT compatible pin.
https://docs.arduino.cc/language-reference/en/functions/digital-io/digitalwrite/
Implementations§
Source§impl DigitalOutput
impl DigitalOutput
Sourcepub fn new<T: Into<PinIdOrName>>(
board: &dyn Hardware,
pin: T,
default: bool,
) -> Result<Self, Error>
pub fn new<T: Into<PinIdOrName>>( board: &dyn Hardware, pin: T, default: bool, ) -> Result<Self, Error>
Creates an instance of a DigitalOutput attached to a given board.
§Errors
HardwareError::UnknownPin: this function will bail an error if the pin does not exist for this board.HardwareError::IncompatiblePin: this function will bail an error if the pin does not support OUTPUT mode.
Trait Implementations§
Source§impl Clone for DigitalOutput
impl Clone for DigitalOutput
Source§fn clone(&self) -> DigitalOutput
fn clone(&self) -> DigitalOutput
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DigitalOutput
impl Debug for DigitalOutput
Source§impl Display for DigitalOutput
impl Display for DigitalOutput
Source§impl Output for DigitalOutput
impl Output for DigitalOutput
Source§fn set_state(&mut self, state: State) -> Result<State, Error>
fn set_state(&mut self, state: State) -> Result<State, Error>
Internal only: you should rather use Self::turn_on(), Self::turn_off() functions.
Source§fn get_default(&self) -> State
fn get_default(&self) -> State
Returns the actuator default (or neutral) state.
Source§fn animate<S: Into<State>>(
&mut self,
state: S,
duration: u64,
transition: Easing,
)
fn animate<S: Into<State>>( &mut self, state: S, duration: u64, transition: Easing, )
Animates the output of the device. In other word: the state of the device will be animated from
current step to targeted step through an interpolation of in-between states.
The function will last for the required duration and the interpolation will follow an easing
transition function. Read more
Source§fn is_busy(&self) -> bool
fn is_busy(&self) -> bool
Indicates the busy status, ie if the device is running an animation.
impl Device for DigitalOutput
Auto Trait Implementations§
impl Freeze for DigitalOutput
impl !RefUnwindSafe for DigitalOutput
impl Send for DigitalOutput
impl Sync for DigitalOutput
impl Unpin for DigitalOutput
impl !UnwindSafe for DigitalOutput
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