My one friend need help to modify the wifi doorbell for handicapped person.
When the handicapped vehicle reached in the parking area the HC04 Detect the car movement and if distance from camera to vehicle is within 1 meters the wifi doorbell call automatically.
In the undermentioned code we need to detect that the vehicle parked or moving and if parked then a light on D12 on till car left the parking area, Also the D13 relay on for 2 to 5 seconds.
Can some one help me to solve this problem.
#define trigPin 6 //Define the HC-SE04 triger on pin 6 on the arduino
#define echoPin 5 //Define the HC-SE04 echo on pin 5 on the arduino
#define bulb 13 //Define the relay signal on pin 13 on the arduino
#define bulb2 12 // Define the Light on pin 12 to check, if sensor triggerd for long time
void setup()
{
Serial.begin (9600); //Start the serial monitor
pinMode(trigPin, OUTPUT); //set the trigpin to output
pinMode(echoPin, INPUT); //set the echopin to input
pinMode (bulb, OUTPUT); //set the bulb on pin 9 to output
}
void loop()
{
int duration, distance; //Define two intregers duration and distance to be used to save data
digitalWrite(trigPin, HIGH); //write a digital high to the trigpin to send out the pulse
delayMicroseconds(500); //wait half a millisecond
digitalWrite(trigPin, LOW); //turn off the trigpin
duration = pulseIn(echoPin, HIGH); //measure the time using pulsein when the echo receives a signal set it to high
distance = (duration/2) / 29.1; //distance is the duration divided by 2 becasue the signal traveled from the trigpin then back to the echo pin, then devide by 29.1 to convert to centimeters
if (distance < 100) //if the distance is less than 100 CM
{
Light(); //execute the Light subroutine below
}
Serial.print(distance); //Dispaly the distance on the serial monitor
Serial.println(" CM"); //in centimeters
delay(500); //delay half a second
}
void Light() //Start the Light subroutine
{
digitalWrite(bulb, HIGH); //turn on the light
delay (500); //wait 5 seconds
digitalWrite(bulb, LOW); //turn off the light
}