pub struct L298n { /* private fields */ }Expand description
Controls a L298N circuit motor connected on GPIO ports.
Get an advanced explanations about L298N circuit motors on https://www.dprg.org/l298n-motor-driver-board-drive-modes/.
Implementations§
Source§impl L298n
impl L298n
Sourcepub fn new(in1: u32, in2: u32, ena: u32) -> Self
pub fn new(in1: u32, in2: u32, ena: u32) -> Self
Creates a new L298n object for a motor on three GPIO pins from
their number.
Sourcepub fn forward(&mut self) -> Result<(), Error>
pub fn forward(&mut self) -> Result<(), Error>
Sets the first direction pin to high and the second to low.
Sets the speed pin to high in order to activate the motor.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for L298n
impl RefUnwindSafe for L298n
impl Send for L298n
impl Sync for L298n
impl Unpin for L298n
impl UnwindSafe for L298n
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