Back to: Robotics & Artificial Intelligence (Class IX)
The Autobot is a basic robot controlled using two DC motors, an L298N motor driver, and an Arduino Uno. It follows a sequence of movements:
✅ Move forward for 2 seconds
✅ Move backward for 2 seconds
✅ Turn left for 2 seconds
✅ Turn right for 2 seconds
✅ Stop for 2 seconds
Components Required
- Arduino Uno – The brain of the robot
- L298N Motor Driver – Controls the motors
- Two DC Motors – For movement
- Power Source – 9V battery or Li-ion battery pack
- Chassis – The robot body
- Jumper Wires – For wiring

Programming
int IN1=9;
int IN2=10;
int IN3=11;
int IN4=12;
void setup()
{
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
}
void loop()
{
moveForward();
delay(2000); // Move forward for 2 seconds
moveBackward();
delay(2000); // Move backward for 2 seconds
turnLeft();
delay(2000); // Turn left for 2 seconds
turnRight();
delay(2000); // Turn right for 2 seconds
stopRobot();
delay(2000); // Stop for 2 seconds
}
void moveForward()
{
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void moveBackward()
{
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void turnLeft()
{
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void turnRight()
{
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void stopRobot()
{
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
How It Works
- Moves forward for 2 seconds
- Moves backward for 2 seconds
- Turns left for 2 seconds
- Turns right for 2 seconds
- Stops for 2 seconds, then repeats
Applications of This Autobot
✔ Basic Robotics Learning
✔ Obstacle Avoidance (with sensors)
✔ Autonomous Navigation (AI-based modifications)
✔ Line-Following Robots (with IR sensors)