![Pololu MC33926 Скачать руководство пользователя страница 17](http://html1.mh-extra.com/html/pololu/mc33926/mc33926_user-manual_1574945017.webp)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "DualMC33926MotorShield.h"
DualMC33926MotorShield md;
void
stopIfFault()
{
if
(md.getFault())
{
Serial.println(
"fault"
);
while
(1);
}
}
void
setup()
{
Serial.begin(115200);
Serial.println(
"Dual MC33926 Motor Shield"
);
md.init();
}
void
loop()
{
for
(
int
i = 0; i <= 400; i++)
{
md.setM1Speed(i);
stopIfFault();
if
(
abs
(i)%200 == 100)
{
Serial.print(
"M1 current: "
);
Serial.println(md.getM1CurrentMilliamps());
}
delay(2);
}
for
(
int
i = 400; i >= -400; i--)
{
md.setM1Speed(i);
stopIfFault();
if
(
abs
(i)%200 == 100)
{
Serial.print(
"M1 current: "
);
Serial.println(md.getM1CurrentMilliamps());
}
delay(2);
}
for
(
int
i = -400; i <= 0; i++)
{
md.setM1Speed(i);
stopIfFault();
if
(
abs
(i)%200 == 100)
{
Serial.print(
"M1 current: "
);
Serial.println(md.getM1CurrentMilliamps());
}
delay(2);
}
for
(
int
i = 0; i <= 400; i++)
{
md.setM2Speed(i);
stopIfFault();
if
(
abs
(i)%200 == 100)
?
Pololu Dual MC33926 Motor Driver Shield User’s Guide
© 2001–2017 Pololu Corporation
3. Getting Started with an Arduino
Page 17 of 30