You are on page 1of 3

Project Name

09.04.20XX

Your Name
Your Company
123 Your Street
Your City, ST 12345
1

ALGORITHM:

Step 1: Define the variables required for the program.

Step 2: Initialize the value to the variable as counter=0, input = 0;


cruise control = 0; adaptive CC = 0; CCspeed = 0; ACCspeed = 0;

Step 3: Set up a continuous loop until the program is canceled

Step 4: Set up a continuous inner loop until you press the button and
set the input variable

Step 5: Read the inputs provided by the operator

Step 6: If the speed up button is pressed, initialize input=1 and go to


step 12 by breaking the loop

Step 7: If the speed down button is pressed, initialize input=2 and go to


step 13 by breaking the loop

Step 8: If cruise button is pressed then cruise = 1 and CCspeed=counter


go to step 14 by breaking out of loop

Step 9: If the adaptive cruise control button is pressed, initialize


adaptiveCC = 1 and ACCspeed = counter go to step 14 by breaking the
loop

Step 10: If the cancel button is pressed, initialize cruise control = 0,


adaptiveCC = 0, ACCspeed = 0 CCspeed = 0; go to the step by breaking
out of the loop

Step 11: Switch for that input

Step 12: If input=1 then counter=counter+1 and go to step 17

Step 13: If input=2 check if counter is greater than zero, if so then


counter=counter-1 and go to step 17
2

Step 14: Else check if counter > 0 && cruiseControl == 0 && adaptiveCC
== 0 to know if cruise control or adaptive cruise control mode is set, if
the above condition is true then go to step 15 else step 16

Step 15: counter = counter – 1 and go to step 17

Step 16: If the adaptive cruise control is equal to 1, read the sensor
value from the ultrasonic pin, then check if the sensor value < 0.5 and
the counter > 0, then decrease the counter value by one, otherwise if
the counter < ACC speed, increase the counter value by 1

Step 17: print the counter

IMAGE REPRESENTATION:

Circuit Diagram:

You might also like