Hardware Reference
In-Depth Information
The
M1_set()
and
M2_set()
functions are defined near the bottom and do the
work of configuring the motor drivers into a particular state. They take a single ar-
gument of
speed
, as defined between
-1
(maximum reverse),
0
(stop), and
1
(maximum forward).
Perform simple bounds checking to ensure that speed values are between
-1
and
1
.
The
analogWrite()
call uses the absolute value of
speed
, making any negat-
ive numbers a positive magnitude.