Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer all parts and fully explain! Below is the Sample Sumo Bot Code using arduino programming. The Example Code is: // Attach QRE sensors

image text in transcribedPlease answer all parts and fully explain! Below is the Sample Sumo Bot Code using arduino programming.

The Example Code is:

// Attach QRE sensors #define QRE_FL 9 // Front left QRE sensor labeled QRE_FL #define QRE_FR 8 // Front right QRE sensor labeled QRE_FR int QRE_threshold; // // Attach servomotors #include // Include servo library Servo servo_L; // Define left servomotor Servo servo_R; // Define right servomotor void setup() { Serial.begin(9600); servo_L.attach(13); servo_R.attach(12); } void loop() { int QRE_Value_FL = readQRE_FL(); int QRE_Value_FR = readQRE_FR(); QRE_threshold = 1000; Serial.println("Front Left QRE:"); Serial.println(QRE_Value_FL); Serial.println("Front Right QRE:"); Serial.println(QRE_Value_FR);

if (QRE_Value_FL

{ Serial.println("Reverse"); servo_L.writeMicroseconds(180); servo_R.writeMicroseconds(0); delay(1500); } else if (QRE_Value_FL QRE_threshold) { Serial.println("Turn Right"); servo_L.writeMicroseconds(180); servo_R.writeMicroseconds(180); delay(150); } else (QRE_Value_FL > QRE_threshold && QRE_Value_FR

} else { Serial.println("Go Forward"); servo_L.writeMicroseconds(0); servo_R.writeMicroseconds(180); delay(100); } } int readQRE_FL() { pinMode( QRE_FL, OUTPUT ); digitalWrite( QRE_FL, HIGH ); delayMicroseconds(10); pinMode( QRE_FL, INPUT ); long time = micros(); while (digitalRead(QRE_FL) == HIGH && micros() - time

(4) Please identify the following within the sumo bot code: (a) What digital pin is connected to QRE_FL? (b) What is the variable name for the left servomotor? (c) How many sensors are being used? (d) What digital pin is attached to the left servomotor? (e) Within each loop, write what the output is to the serial monitor... just as it would appear to you on your computer screen. (f) What is the maximum time that one instance of the loop will keep its motors turned on? (g) What is the minimum time that one instance of the loop will keep its motors turned on? (4) Please identify the following within the sumo bot code: (a) What digital pin is connected to QRE_FL? (b) What is the variable name for the left servomotor? (c) How many sensors are being used? (d) What digital pin is attached to the left servomotor? (e) Within each loop, write what the output is to the serial monitor... just as it would appear to you on your computer screen. (f) What is the maximum time that one instance of the loop will keep its motors turned on? (g) What is the minimum time that one instance of the loop will keep its motors turned on

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

Beginning Apache Cassandra Development

Authors: Vivek Mishra

1st Edition

1484201426, 9781484201428

More Books

Students also viewed these Databases questions