This project will allow you to create a basic autonomous obstacle avoidance vehicle with Arduino.
Functional Parts in the Project:
- FeeTech FT-MC-002-SMC – https://amzn.to/2MLIzoF
- FeeTech 2CH-SM-Controller (Motor Controller)
- Arduino Uno – https://store.arduino.cc/usa/arduino-uno-rev3
- IR Sensor – https://amzn.to/2IDw7SE
- Micro Breadboard – https://amzn.to/2XbFX7w
- USB Battery Pack
#include <Servo.h>
#define IR 7
Servo lServo;
Servo rServo;
int Obstacle;
void setup() {
pinMode(IR, INPUT);
lServo.attach(8);
rServo.attach(9);
}
void loop() {
Obstacle = digitalRead(IR);
if (Obstacle == LOW)
{
lServo.write(80);
rServo.write(100);
}
else
{
lServo.write(80);
rServo.write(80);
}
delay(100);
}
Be the first to comment