12 in 1 Programming Tutorials With WeeeCode V2
12 in 1 Programming Tutorials With WeeeCode V2
12-In-1
WeeeBot RobotStorm
2
A. Walking robot
Material
1. Walking robot
2. Computer
Make the walking robot go forward for 3 seconds and backward for 3 seconds.
Program Idea
3
Reference Code
4
Control RGB lamps to randomly display one color every 0.5 seconds.
Program Idea
Reference Code
5
On the basis of the first project, we modified the block "wait 3 seconds" to block "repeat 3
times". During the repeated execution, the RGB ultrasonic sensor is allowed to change colors,
with an interval of 1 second for each color change. This is consistent with the time we waited for
3 seconds before, and the robot can change colors while walking.
Program Idea
Reference Code
Expansion: You can try to program and control the robot's walking rhythm and light change to
correspond to the song rhythm, so that the robot can dance with the music rhythm.
6
B. Rolling Tank
Material
1. Rolling Tank
2. Computer
The light intensity in the environment is detected by the light sensor, If the light detected value
is 300 under normal situation, and the value of blocking the light sensor by hand is 100, then we
can take the median value 200 as the judgment value. When the value is greater than 200, the
robot would go forward. When the value is less than 200, the robot is stop.
7
Program Idea
Reference Code
8
The sound intensity in the environment is detected by the sound sensor. If the sound detected
value is 100 under normal situation, and the sound sensor value is 400 if there is noise, then we
can take the median value 250 as the judgment value. When the value is greater than 250, the
robot would go forward. When the value is less than 250, the robot is stop.
Program Idea
Reference Code
9
Note: Before re-judging the detection of the sound sensor, the robot should be allowed to stop
firstly, to avoid the noise during the movement of the robot interferes with the detected value of
Expansion: You can try to make a "coward" robot by combining light sensor with sound sensor,
it will move when there is no one at night.
10
C. Spider Robot
Material
1. Spider Robot
2. Computer
pressed the ↑key, the robot goes forward; if IR remote controller is pressed the ↓ key, the robot
goes back; if IR remote controller is pressed the ← key, the robot turns left; if IR remote
Program Idea
11
Reference Code
12
Control the buzzer module to broadcast the sound according to the notes and tones of the
music.
Program Idea
Reference Code
13
Expansion: You can make a music robot by pressing different buttons of the remote controller,
and the robot sings different songs.
D. Detection Robot
Material
1. Detection Robot
2. Computer
Use RGB ultrasonic sensor to detect whether there is an obstacle in front of the robot. If RGB
ultrasonic sensor detects a small value, it means there is an obstacle in front, and the robot will
turn. If RGB ultrasonic sensor detects a large, it means there is no obstacle ahead and the robot
Program Idea
Reference Code
15
The robot changes its motion state according to the detected distance of the RGB ultrasonic
sensor. When the RGB ultrasonic sensor detects a small value, it means the robot is close to the
object in front, then the robot moves back. When the detected value remains unchanged within
an interval, then the front object can be considered stationary, and the robot stop. When the
RGB ultrasonic sensor detects a large value, it means the robot is far away from the front object,
then the robot moves forward. In this way, the effect of the robot following the movement of
Program Idea
16
Reference Code
Note: The RGB ultrasonic sensor detected value, which can make robot stop moving, must be an
interval. Because RGB ultrasonic sensor detected value will wave, if it is not a range but a specific
value, the robot will move back and forward instead of being static.
Expansion: You can make a more intelligent robot: when there are obstacles in front of the robot,
the robot don’t go forward even if the remote controller buttons were pressed, and the RGB
light will turn on the red light, the buzzer module will sound an alarm to remind the operator
that there are obstacles in front of the robot, the robot can’t go forward.
17
E.3-wheel Robot
Material
1. Three-wheeled Robot
2. Computer
There are two ways of robot line-following: ① the black line clip line-following sensor (the line is
wider than the sensor spacing); ② the line-following sensor clip the black line (the sensor
1 the black line clips the line inspection sensor (the line width is larger than the sensor
spacing).
18
Program Idea
Reference Code
19
Note: the line-following inspection judgment value needs to be adjusted according to the actual
Video:
2 The line-following sensor clips the black line (the sensor spacing is wider than the line).
Program Idea
20
Reference Code
21
Like the feeding robot, when the robot encounters an obstacle in front of the line, the robot
stops line-following and issues an alarm. If there is no obstacle in front, the robot will do line-
following normally.
Program Idea
22
Reference Code
Expansion: Try to design more complex line-following route, and use more optimized line-
following algorithms or more line-following sensors to enable robots to work.
23
F.Forklift robot
Material
1. Forklift robot
2. Computer
Use the up, down, left and right buttons of the remote controller to make robot move forward,
backward, left turn and right turn, use the A and D buttons of the remote controller to control
up and down movement of fork of the forklift robot, and limit the moving range of the fork
Program Idea
Note: When the detected value of limit switch module is 1, press the direction key of the remote
controller, the robot cannot move, otherwise the limit switch module will be damaged.
25
Reference Code
26
Use the up, down, left and right buttons of the IR remote controller to control the movement of
the robot in all directions, use the A and D buttons of the remote controller to control the up
and down movement of the fork of the forklift robot, use the numeral buttons of the remote
controller to revise the movement speed of the robot, and make different sounds while pressing
the remote controller buttons. In the process of programming, try to use the modular building
Program Idea
27
Reference Code
28
Extension: Use the line-following sensor on forklift robot, to realize automatic line-following and
objects on the designed route.
29
Material
1. Camera Dolly Robot
2. Computer
Use the block “set encoder motor power to…” to precisely control the turning angle of the wheel
Program Idea
30
Reference Code
Note: When use the block “set encoder motor power to…” in power supply state, if there is an
external force trying to roll the wheel, the encoder will rotate in the opposite direction to keep the
backward movement. Use the left and right buttons of the remote controller to control the left
and right turns of the camera platform. Use the button 1, 4 and 7 of the remote control to
control the robot's left turns at different angles. Use the button 3, 6 and 9 of the remote control
to control the robot's right turns at different angles. Place the mobile phone on the
photographic platform to transit the images captured from one mobile phone to another
mobile phone through WeChat or video capture software to realize remote transmission of
images.
Program Idea
32
Reference Code
Expansion: Try to install the camera structure on the forklift robot and remotely control the
forklift robot to carry objects through the camera.
33
1. Use the up and down buttons of the remote controller to control the M1 motor, in other
words, it controls the up and down swing of the first mechanical arm; 2. use the left and right
button of the remote controller to control the 3-port DC motor, in other words, it controls the
left and right movement of the chassis; 3. use the 2,8 buttons of the remote controller to control
the 4-port DC motor, in other word, it controls the up and down swing of the second
mechanical arm; 4. use the 4,6 buttons of the remote controller to control the M2 motor, in
other words, it controls the opening and closing of the mechanical claw.
Program Idea
34
35
Reference Code
36
Based on project 1, a speed regulating function is added to the remote control three-axis
mechanical arm. The A, B and C keys of the remote controller are used to change the left and
right movement speed of the chassis, and the D and E keys of the remote controller are used to
change the movement speed of the mechanical arm (which is close to the mechanical claw).
Program Idea
37
Reference Code
Extension: You can place a lot of small objects around the three-axis manipulator, and control
the manipulator to move them to the same place or stack them up in a certain period of time.
38
I. Bartender Robot
Material
1. Bartender Robot
2. Computer
backward movement of the robot, the left and right buttons of the remote controller are used to
control the left and right turn of the wheels in front of the robot, and the A and D buttons of the
remote controller is used to control the up and down tilt of the water pouring platform to pour
water. It should be noted here that the limit switch module is installed on the water pouring
platform. Therefore, if the water pouring platform rises too high, the limit switch will be
triggered, at this time, pressing the button of the remote control will cause the robot will not
respond. At the same time, we can use the 1 to 9 buttons of the remote controller to control the
speed of the robot, and the buzzer will make different sounds when a different button is pressed,
Program Idea
40
41
Reference Code
42
Place the water cup and robot in position ahead of time, and then the forward distance of the
robot is adjusted according to the positional relationship between the two, so that it just moves
to the side of the water cup, next, the fall time and the pouring time are adjusted according to
the position of the robot’s pouring platform. In addition, we can use clapping as its starting
Program Idea
43
Reference Code
Note: This program is only a reference program. The parameters in the program should be
Material
1. Robot Arm Tank
2. Computer
Use the up, down, left and right buttons of the remote controller to control the movement of
the robot, use the 2 and 8 buttons of the remote controller to control the rising and falling of
the manipulator, and use the 4 and 6 buttons of the remote controller to control the opening
Program Idea
Reference Code
46
On the basis of project 1, we add a limit switch module and a double-way line-following module,
which both are used to limit the movement range of the manipulator to avoid damaging the
mechanical structure.
Program Idea
47
Reference Code
48
Design a route for automatic handling robot. Assuming that the object block is located in the
circular ring and the robot is located at the crossing, the object blocks need to be transported
into the square box. Programming control the robot for automatic handling.
Program Idea
49
Reference Code
Note: This program is only a reference program. The parameters in the program should be
K. Ball Launcher
Material
1. Ball Launcher
2. Computer
Use the up, down, left and right buttons of the remote controller to control the movement of
the robot chassis, use the A and C buttons of the remote controller to control the rising and
falling of the shooting platform, and use the B button of the remote controller to control the
launching.
51
Program Idea
Reference Code
52
Note: The shells storage structure can be downloaded in 3D model from the official website.
green, cyan, blue, purple and white in sequence, and flashes three times as a signal prompt
Program Idea
Reference Code
53
Combine with project 1 and 2, when the button B of the remote controller was pressed, the
robot will issue a lamp signal prompt before launching. After the prompt is completed, the
Program Idea
54
Reference Code
55
L.Self-balancing Robot
Material
1. Self-balancing robot
2. Computer
Use the block " Gyroscope sensor acceleration detection " to detect the accelerations of the X
axis, Y axis and Z axis of the gyroscope, so as to learn changes of the acceleration of Gyroscope
Sensor, and combine the roles with it. When the gyroscope is stationary or shaking, the roles can
Program Idea
Reference Code
Note: To detect the acceleration value of the axis, it is best to disassemble the sensor from the
robot.
After running the program, when the gyroscope is stationary, the roles will say “Steady!” for 1
second, when the gyroscope moves, the roles will say “Shaking!” for 1 second.
58
Use the block " Gyroscope sensor angle detection " to detect the angles of the X axis, Y axis and
Z axis of the gyroscope, so as to learn the changes of the gyroscope sensor angle, and combine
the roles with it. When the gyroscope tilts or rotates, the roles can perform corresponding
actions.
Program Idea
Note: The angle detected value of an axis is the angle of rotation around the axis. We already know
the direction of the X axis. What we call lean forward or backward is actually the angle of rotation
Reference Code
Angle Measurement of Gyro Sensor
After executing the program, when the gyroscope leans forward, the role moves upward. When
the gyroscope leans backward, the role moves down. When the gyroscope leans to the left, the
role moves to the left. When the gyroscope moves to the right, the role moves to the right.
60
This program is difficult to write, it requires a very complicated processing of the data detected
by gyroscope, then we just observe how the self-balancing robot works。
We add the factory program onto the control board firstly, select the 12-in-1 storm in the
factory firmware. Then we make the robot upright, turn on the power switch, and press the D
key of the remote controller to enter the self-balancing mode. We can learn the self-balancing
robot keeps walking upright. At the same time, other robots we made before also can realize