Write an Arduino code that contain both (2 analog line sensors breckout) and (1
ID: 2081979 • Letter: W
Question
Write an Arduino code that contain both (2 analog line sensors breckout) and (1 Ultra sonic sensor) to follow the white line and avoid obstacles. PS; the white line could be on the left or the right of the car or on both sides .. that is why we have two sensors. Thus only one will be used depending on the car position in the race track. Please show the Arduino Uno wire connection if possible.
In other words, write an arduino code to satisfy the following:
A racetrack will be built, it will contain guiding walls and white lines on the ground. The attached pictures show a general idea of the race track.
The teams will build their own self-driving vehicles using line following mechanism, as well as obstacle detection and avoiding mechanism to reach to the “Finish” line.
The student will be free to develop their own methods to achieve the self-driving goal of this competition, however, the vehicle must be autonomously driven with no human intervention.
The autonomous driving must be activated after powering up the vehicle and waiting for a “Start” push button.
The vehicle must be equipped with a “Kill” switch which will completely turn off the power from the vehicle when toggled.
The race will consist of two parts, for the two parts, the goal is reach the “Finish” line in the shortest time with no collision.
Explanation / Answer
#include <LiquidCrystal.h> // includes the LiquidCrystal Library
LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)
const int trigPin = 9;
const int echoPin = 10;
long duration;
int distanceCm, distanceInch;
void setup() {
lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin, LOW
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.