(a) Draw a flow chart to a program that will have a steering servo motor move based on an input from a light sensor. The rover can follow the dark line on the floor because of the light reflected from that dark line has low intensity. When the rover goes off course and there is no more dark line on the floor below the rover, the light intensity is higher. The light intensity values of the light sensor will range from 0 to 1023 (higher values corresponding to brighter light). When the value of the light intensity increases above 400 it means that the rover is off course and the servo motor that controls the steering of the rover should be activated to put the rover back on course. We will assume that if light intensity is below 400, no steering should be performed, when the light intensity is above 400, the servomotor should go to -45 degrees until the light intensity drops below

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 30SA
icon
Related questions
icon
Concept explainers
Question
(a) Draw a flow chart to a program that will have a steering servo motor move based on
an input from a light sensor. The rover can follow the dark line on the floor because of
the light reflected from that dark line has low intensity. When the rover goes off course
and there is no more dark line on the floor below the rover, the light intensity is higher.
The light intensity values of the light sensor will range from 0 to 1023 (higher values
corresponding to brighter light). When the value of the light intensity increases above
400 it means that the rover is off course and the servo motor that controls the steering
of the rover should be activated to put the rover back on course. We will assume that if
light intensity is below 400, no steering should be performed, when the light intensity is
above 400, the servomotor should go to -45 degrees until the light intensity drops below
400. We will assume for simplicity that our rover only veers to the right to get off the
line and it would require to move servo to -45 degrees to put the rover back over the
line. Once the light intensity falls below 400, the servo moves to 0 degrees. This
procedure is performed in a loop to keep the rover over the dark line.
(b) Write this algorithm using pseudo code.
(c) Write the algorithm as if you are writing in Arduino IDE.
Transcribed Image Text:(a) Draw a flow chart to a program that will have a steering servo motor move based on an input from a light sensor. The rover can follow the dark line on the floor because of the light reflected from that dark line has low intensity. When the rover goes off course and there is no more dark line on the floor below the rover, the light intensity is higher. The light intensity values of the light sensor will range from 0 to 1023 (higher values corresponding to brighter light). When the value of the light intensity increases above 400 it means that the rover is off course and the servo motor that controls the steering of the rover should be activated to put the rover back on course. We will assume that if light intensity is below 400, no steering should be performed, when the light intensity is above 400, the servomotor should go to -45 degrees until the light intensity drops below 400. We will assume for simplicity that our rover only veers to the right to get off the line and it would require to move servo to -45 degrees to put the rover back over the line. Once the light intensity falls below 400, the servo moves to 0 degrees. This procedure is performed in a loop to keep the rover over the dark line. (b) Write this algorithm using pseudo code. (c) Write the algorithm as if you are writing in Arduino IDE.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning