i want the arduino code please

//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
}
Car Parking Sensor Build a simple Car parking sensor system using the Arduino. Use the provided U...
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 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 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). 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 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 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 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 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 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
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...