Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Explain the code line by line?! #include HCSR04,h> #define leftMotorForwardPin 8 #define leftMotorBackwardPin 9 #define rightMotorForwardPin 6 #define rightMotorBackwardPin 7 #define leftMotorSpeedPin 11 #define rightMotorSpcedPin

Explain the code line by line?!
image text in transcribed
image text in transcribed
image text in transcribed
\#include HCSR04,h> \#define leftMotorForwardPin 8 \#define leftMotorBackwardPin 9 \#define rightMotorForwardPin 6 \#define rightMotorBackwardPin 7 \#define leftMotorSpeedPin 11 \#define rightMotorSpcedPin 10 \#define IR Front 4 \#define IR_Back 2 UltraSonicDistanceSensor ultrasonic(A5,A4); float distance; void setup() i pinMode(leftMotorSpeedPin, OUTPUT): pinMode(leftMotorForwardPin, OUTPUT); pinMode(leftMotorBackwardPin, OUTPUT): pinMode(rightMotorSpeedPin, OUTPUT); pinMode(rightMotorForwardPin, OUTPUT); pinMode(rightMotorBackwardPin, OUTPUT); Serial.begin(9600); pinMode(IR_Front, INPUT); pinMode(IR_Back, INPUT): digitalWrite(leftMotorSpeedPin, HIGH); / 0-255 digitalWrite(rightMotorSpeedPin, HIGH); delay(2000); void loop() \{ distance = ultrasonic.measureDistanceCm(), // Lise "CM" for centimeters or "INC" for inches Serial.printlin(distance): int IrF_Result = digitaIRead(IR_Front); int IrB_Result = digitalRead(IR_Back); void stop() digitalWrite(leftMotorForwardPin, LOW); digitalWrite(leftMotorBackwardPin, LOW); digitalWrite(rightMotorForwardPin, LOW); digitalWrite(rightMotorBackwardPin, LOW); \}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

What is nonverbal communication?

Answered: 1 week ago