Question

i want the arduino code please

null

Car Parking Sensor Build a simple Car parking sensor system using the Arduino. Use the provided Ultrasonic Sensor to measure


Car Parking Sensor Build a simple Car parking sensor system using the Arduino. Use the provided Ultrasonic Sensor to measure the distance between the sensor and an object. When an object is detected within a defined range, a buzzer must beep repeatedly at a certain rate. And as the object gets closer, the beeping gets faster. Your design must meet the following requirements 1. Calibrate the range of the Ultrasonic Sensor readings using a push button to set maximum and minimum values for the distance. As long as this button is pushed the program shall be in calibration mode. An LED shall be used as an indication for the calibration mode. This can be done at anytime while the program is running 2. An active buzzer shall beep as mention above along with an LED flashing with the beep 3. The defined range shall be divided into three sections. Section 1: 2/3 to max of the range. Section 2: 1/3 to 2/3 of the range. Section 3: min to 1/3 of the range 4. A servo motor shall be used also to indicate the detected distance. It shall move 60°, 120° and 180° when the object is in section 1, 2 and 3 respectively 5. An LCD shall be used to display the following messages Line 1 "Empty Range" when there is nothing in the defined range "Object in Range" when there is an object in the defined range Line 2 "Obj: Far" when the object is in section 1 "Obj: Close" when the object is in section 2 "Obj: very Close" when the object is in section 3 .Any high power component (requires high current) must be driven by an external circuit powered by an external supply variables shall be named properly You can use the serial monitor in the Arduino IDE for debugging purposes The code must be well commented, explaining every part of the code. And The group must show and explain the whole operation of the project in detail .
0 0
Add a comment Improve this question Transcribed image text
Answer #1

//PLACEMENT OF PIN ON ARDUINO
#define trigPin 0 //ULTRASONIC TRIG PIN
#define echoPin 1 //ULTRASONIC ECHO PIN
#define blue 10   //LED BLUE PIN
#define red 12    //LED RED PIN
#define green 11 //LED GREEN PIN

//DEFINING PIN MODES
void setup() {
Serial.begin (9600); // begins serial
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(red, OUTPUT);
pinMode(green, OUTPUT);
   pinMode(blue, OUTPUT);
}

void loop() {
// This is where the calculation for the distance of the object happens
long duration, distance; // CREATE VARIABLES
digitalWrite(trigPin, LOW); // TURN OFF TRIG PIN
delayMicroseconds(2);       // WAIT
digitalWrite(trigPin, HIGH); // TURN ON TRIG PIN
delayMicroseconds(10);       // WAIT
digitalWrite(trigPin, LOW); // TURN OFF TRIG PIN
duration = pulseIn(echoPin, HIGH);   // WAITS FOR ECHO PIN TO BE HIGH
distance = (duration/2) / 29.1;   // CALCULATION TO FIND DISTANCE TRAVELLED BY WAVE USINF TIME,

// This is where the LED On/Off happens
if (distance <= 10) { // if the distance is equal to or less than 10 cm
    digitalWrite(red,HIGH); // red is turned on
digitalWrite(green,LOW);
digitalWrite(blue, LOW);
}

if (distance >= 20) { // if the distance is equal to or greater than 20 cm
    digitalWrite(green, HIGH); // green is turned on
    digitalWrite(red, LOW);
    digitalWrite(blue,LOW);
}

if (distance >10 && distance <20 ) { // if the distance is between 10 cm to 20 cm
    digitalWrite(blue, HIGH); // blue is turned on
    digitalWrite(red, LOW);
    digitalWrite(green,LOW);
}


if (distance >= 200 && distance <= 0){ // if the distance is greater than 200 cm or less than 0 cm
    Serial.println("Out of range"); // serial print "out of range"
}

else {
    Serial.print(distance); // display distance on serial
    Serial.println(" cm"); // display units "cm" on serial
}
delay(500); // wait 500ms
}

Add a comment
Know the answer?
Add Answer to:
Car Parking Sensor Build a simple Car parking sensor system using the Arduino. Use the provided U...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • By using Arduino write a code that connects two LEDs to two push-buttons. Each button controls...

    By using Arduino write a code that connects two LEDs to two push-buttons. Each button controls the state of its connected LED. The LEDs can be in one of two states: Blink-mode or Off-mode. When a button-press event is detected, its connected LED will begin blinking (turning on and off) and when a button-press is detected, its connected LED will turn off. The application should blink one of the LEDs at a rate of 1 second, and the other LED...

  • Write an Arduino code to read the current temperature using the LM35 temperature sensor. The code...

    Write an Arduino code to read the current temperature using the LM35 temperature sensor. The code should include the following if the temperature is more than 45 "C: • Turn ON red LED, and after 1 second turn ON the yellow LED, and after another 2 seconds tum On the Green LED. One second later the three LEDS should start blinking (all LEDs OFF for 0.5 seconds, then all LEDS ON for 1 minute), and turn OFF all LEDs after...

  • I am doing an Arduino Uno project where I made a "Simon says" memory game with 3 neopixel LED str...

    I am doing an Arduino Uno project where I made a "Simon says" memory game with 3 neopixel LED strips and 3 - ultrasonics. I have them working independently but I need to combine the code so they work together. Here is what I have: Memory Game #define PLAYER_WAIT_TIME 2000 // The time allowed between button presses - 2s byte sequence[100]; // Storage for the light sequence byte curLen = 0; // Current length of the sequence byte inputCount =...

  • Need help in filling the missing lines in the program template provided down below. (Arduino Uno)....

    Need help in filling the missing lines in the program template provided down below. (Arduino Uno). Using the program template provided, fill in the missing lines in the program which increments an unsigned integer variable when the “pin 2” button is pressed and decrements an unsigned integer variable when the “pin 3” button is pressed. Your program must display the integer variable (modulo 8) on the 7-segment LED display you designed in the previous lab. Once again you should be...

  • Ultrasonic motion sensor Pre - laboratory Assignment In experiments 1 and 2, you will use a...

    Ultrasonic motion sensor Pre - laboratory Assignment In experiments 1 and 2, you will use a cart, track, and motion detector like those Spring bumper illustrated in Figure 1 to validate the work-energy theorem end examine the conversation of mechanical energy principle. Sonar reflector Cart Track Data acquisition TC Leveling jacks Figure 1. Experimental setup used in Lab #6 Consider the following exercises/questions relevant to experiments 1 and 2. Question 1. Show that the kinematics equation 12 - v2 =...

  • some context Problem 3: Use simple kinetic theory of gases discussed in section 1.3.2 as well...

    some context Problem 3: Use simple kinetic theory of gases discussed in section 1.3.2 as well as Fourer's law of condustion to prove: 2 R373 D11 = 3113/202pm Dal We were unable to transcribe this imageof a nes. the xed the led negligible The following assumptions about the structure of the cases are made in order to investigate the statistical rules of the random motion of the molecules: The size of the gas molecules is negligible compared with the distance...

  • Identify the argument of the function. 1 2./ 3 .031 Use the unit circle to find...

    Identify the argument of the function. 1 2./ 3 .031 Use the unit circle to find all values of between 0 and 2 for the following Enter your answers as a comma-separated list.) tan . 3.-/2 points Trigo 3.3.043 Graph the unit circle using parametric equations with your calculator set to degree mode. Use a scale of 5. Trace the circle to find the sine and cosine of the angle to the nearest ten thousandth 2100 sin 210°C COS 2100...

  • summatize the following info and break them into differeng key points. write them in yojr own...

    summatize the following info and break them into differeng key points. write them in yojr own words   apartus 6.1 Introduction—The design of a successful hot box appa- ratus is influenced by many factors. Before beginning the design of an apparatus meeting this standard, the designer shall review the discussion on the limitations and accuracy, Section 13, discussions of the energy flows in a hot box, Annex A2, the metering box wall loss flow, Annex A3, and flanking loss, Annex...

  • summarizr the followung info and write them in your own words and break them into different...

    summarizr the followung info and write them in your own words and break them into different key points.   6.5 Metering Chamber: 6.5.1 The minimum size of the metering box is governed by the metering area required to obtain a representative test area for the specimen (see 7.2) and for maintenance of reasonable test accuracy. For example, for specimens incorporating air spaces or stud spaces, the metering area shall span an integral number of spaces (see 5.5). The depth of...

  • please use python and provide run result, thank you! click on pic to make it bigger...

    please use python and provide run result, thank you! click on pic to make it bigger For this assignment you will have to investigate the use of the Python random library's random generator function, random.randrange(stop), randrange produces a random integer in the range of 0 to stop-1. You will need to import random at the top of your program. You can find this in the text or using the online resources given in the lectures A Slot Machine Simulation Understand...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT