Loading…
Ultrasonic obstacle avoidance with servo mount.
Ultrasonic-driven robot that steers around obstacles using a servo-mounted HC-SR04.
Required parts total
৳2,510
9 required components
View Obstacle Avoider KitRead build guideOpen in Robot BuilderQuantities, live stock from the mock inventory, and line prices.
Qty 1 · ৳120 each
Qty 1 · ৳750 each
Qty 1 · ৳150 each
Starter sketches for wiring checks — adapt pin numbers to your board.
HC-SR04 distance cm
Trig on 9, echo on 10.cpp
const int trigPin = 9;
const int echoPin = 10;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
long duration = pulseIn(echoPin, HIGH);
float cm = duration * 0.034 / 2;
Serial.println(cm);
delay(200);
}Qty 2 · ৳180 each
Qty 1 · ৳90 each
Qty 1 · ৳50 each
Qty 1 · ৳220 each
Qty 1 · ৳650 each
Qty 2 · ৳60 each