Self-Balancing Robot
User Guide
36
www.terasic.com
July 12, 2018
x++;
}
else
if
(pCommand[j]==
'='
)
find_equal=
true
;
}
*pParam=
atoi
(Data);
}
bFind =
true
;
}
// if
}
// for
return
bFind;
}
Finally, the control command is converted to the corresponding function for the Self-balancing
robot controlling. For example, the "Backward" command processing in below:
case
CMD_BACKWARD
:
//Backward
led3=0x02;
demo=
false
;
Car.Set_TurnBACKWARD();
break
;
1
1
.
.
7
7
U
U
s
s
i
i
n
n
g
g
t
t
h
h
e
e
I
I
R
R
C
C
o
o
n
n
t
t
r
r
o
o
l
l
l
l
e
e
r
r
In addition to using the mobile phone app to control the robot via the Bluetooth, using an infrared
remote control is also a simple and convenient option.
The infrared remote controller included with the kit package is an infrared remote controller that
uses the NEC protocol. It uses 38K HZ frequency modulation to emit control signals to the infrared
receiver on the robot. The FPGA decoder IP will decode the signal to control the robot motion.
◼
◼
I
I
n
n
f
f
r
r
a
a
r
r
e
e
d
d
R
R
e
e
m
m
o
o
t
t
e
e
C
C
o
o
n
n
t
t
r
r
o
o
l
l
l
l
e
e
r
r
P
P
r
r
o
o
t
t
o
o
c
c
o
o
l
l
s
s
The NEC format composes of a Leader Code, a 16-bit Custom Code, and a 8-bit Key Code. The
Leader Code is transmitted first, which contains 9ms carrier frequency and 4.5ms zero signal, then