Struct rust_gpiozero::output_devices::Motor [−][src]
pub struct Motor { /* fields omitted */ }
Represents a generic motor connected to a bi-directional motor driver circuit (i.e. an H-bridge). Attach an H-bridge motor controller to your Pi; connect a power source (e.g. a battery pack or the 5V pin) to the controller; connect the outputs of the controller board to the two terminals of the motor; connect the inputs of the controller board to two GPIO pins.
Implementations
impl Motor
[src]
impl Motor
[src]pub fn new(forward_pin: u8, backward_pin: u8) -> Motor
[src]
pub fn new(forward_pin: u8, backward_pin: u8) -> Motor
[src]creates a new Motor instance
forward_pin
- The GPIO pin that the forward input of the motor driver chip is connected tobackward
- The GPIO pin that the backward input of the motor driver chip is connected to
pub fn forward(&mut self)
[src]
pub fn forward(&mut self)
[src]Drive the motor forwards at the current speed.
You can change the speed using set_speed
before calling forward