Check out my 2 YOUTUBE channels for more:
- Mrzaizai2k - AI (NEW)
- Mrzaizai2k (old)
Maze solving with wall follower algorithm
The video pretty much explains it all:
YOUTUBE LINK: Wall following car with Arduino_Mrzaizai2k
My Arduino Code: https://drive.google.com/open?id=1q8XpYHIeALv2iSNh2W_P4Ljrv5eGn_sh
Reference:
- Sử dụng cảm biến khoảng cách HC-SR04: http://arduino.vn/bai-viet/233-su-dung-cam-bien-khoang-cach-hc-sr04
- Sử dụng LCD 16x2 với giao tiếp I2C: https://arduinokit.vn/giao-tiep-i2c-lcd-arduino
- Sử dụng motor driver shield L293D: http://arduino.vn/bai-viet/429-lam-du-xe-voi-module-dieu-khien-dong-co-l293d
- Clip full tutorial: https://www.youtube.com/watch?v=zLAac7GA5HE
- Overview
- Functions
2.1 Stop (
dung()
) 2.2 Move Forward (tien()
) 2.3 Move Backward (lui()
) 2.4 Turn Left (retrai()
) 2.5 Turn Right (rephai()
) - Distance Measurement
This Arduino code controls a robot equipped with an Arduino Uno, an ultrasonic sensor (HC-SR04), and four DC motors (AFMotor library). The robot's movements are determined based on measured distances in the front and on the sides. The main functionalities include stopping the robot, moving it forward and backward, and turning it left or right.
Stops all motors, displaying "DUNG" on an LCD.
Moves the robot forward with adjustable speed.
Moves the robot backward with adjustable speed.
Turns the robot to the left.
Turns the robot to the right.
-
Front Distance (
distancefront()
): Measures the distance in front using the HC-SR04 sensor. -
Side Distance (
distanceside()
): Measures the distance on the side using the HC-SR04 sensor.
The main loop continuously measures distances, displays the status on an LCD, and controls the robot's movements based on button input. The code provides flexibility for customizing motor speeds and distance thresholds to suit specific project requirements.