Understanding basic robot movement
Tasks: Make robot move
- Connest both DC motors to RobDuino controller according to [@tbl:motors_to_RobDuino]:
MOTOR | RobDuino Output pins |
---|---|
Left DC Motor - con. A | D7 |
Left DC Motor - con. B | D6 |
Right DC Motor - con. A | D5 |
Right DC Motor - con. B | D4 |
Table: Motors connections to RobDuino Output pins. {#tbl:motors_to_RobDuino}
- Write simple programming instructions to move the robot forward. Make right sequence of programming instructions (e.g.
digitalWrite()
anddelay(time_in_ms)
functions) to achive:- move the robot forward,
- do it for 3000 ms and
- stop the robot.
Questions:
You probably ended up with something like [@lst:051_First_moves]:
void setup()
{
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
digitalWrite(7, HIGH);
digitalWrite(6, LOW);
digitalWrite(5, HIGH);
digitalWrite(4, LOW);
delay(3000);
digitalWrite(7, LOW);
digitalWrite(6, LOW);
digitalWrite(5, LOW);
digitalWrite(4, LOW);
}
void loop()
{
}
: First moves. {#lst:051_First_moves}
- Is this code “easy readable”?
- Why is readable code important?