motors/motors.rs
1// This file is part of "raslib"
2// Under the MIT License
3// Copyright (c) Antonin Hérault
4
5use raslib::L298n;
6
7// Considering the connections are made this way:
8// See https://camo.githubusercontent.com/f9567bf527fdda17c1262b4878e33dc1883dc21ba09ecadb0fe0c584631719d4/68747470733a2f2f616c63616c796e2e6769746875622e696f2f6173736574732f696d616765732f7270692d6d6f746f72732f726173702d6c3239386e2e706e67
9// from : alcalyn.github.io, https://alcalyn.github.io/control-robot-two-engines/
10
11fn main() -> Result<(), std::io::Error> {
12 let mut motor_left = L298n::new(18, 15, 14);
13 let mut motor_right = L298n::new(9, 7, 25);
14
15 motor_left.forward()?;
16 motor_right.forward()?;
17
18 Ok(())
19}