Professional Documents
Culture Documents
Moving Forward and Backward
Moving Forward and Backward
Step 1: First of all, launch the Arduino IDE that you have just
installed. Copy & paste this code into your Arduino IDE.
#include "CytronMakerSumo.h"
void setup() {
MakerSumo.begin();
}
void loop() {
MakerSumo.setMotorSpeed(MOTOR_L, 50); // Left motor forward at speed 50.
MakerSumo.setMotorSpeed(MOTOR_R, 50); // Right motor forward at speed 50.
delay(3000); // Delay for 3 seconds.
Step 5: Create a new folder called "Sumo Robot". (you are free to
decide where to save the folder)
Step 6: Name the program you want to save as "Basic
Navigation".
Make sure you have connected the USB cable on the PC and your
board. You will see "Done uploading" appear at the bottom when
it is done.
Step 8: Unplug the USB cable from your robot. Then turn on the
power, your robot should be moving forward for 3 seconds before
it stops for 1 second then it will move backward for 3 seconds.
And it will keep repeating if you don't turn it off.
Step 9: Try to change the speed of your motor to 150 and reduce
the delay to 1000. Then upload it to your robot again.
#include "CytronMakerSumo.h"
void setup() {
MakerSumo.begin();
}
void loop() {
MakerSumo.setMotorSpeed(MOTOR_L, 150); // Left motor forward at speed 150.
MakerSumo.setMotorSpeed(MOTOR_R, 150); // Right motor forward at speed 150.
delay(1000); // Delay for 1 second.
You may notice now that your robot isn't running forward/
backward in a straight line. Don't worry, it is completely normal
that your robot is not moving straight or behaves differently from
mine or from your friends because every robot is unique just like
you and me.
We will discuss this issue later but we want to bring your attention
to these 2 parameters: speed and delay. From the 2 programs we
made earlier, you should realize that in order to change the robot
speed, you can change the second value inside function:
MakerSumo.setMotorSpeed(MOTOR_L, 150);
1. The floor or the map is not flat. This will cause one of the
wheels not touching the ground and spinning.
or
MakerSumo.setMotorSpeed(MOTOR_L, 150);
MakerSumo.setMotorSpeed(MOTOR_R, 180);