/*======================================================================================= Programmer: Jasmin Allen Date:10-20-18 Program Description: *This program was formatted for an ARDUINO UNO *. The program recognizes whether a child is 90 cm away or closer and energizes two terminals which hypothetically will be loaded with an electromagnetic collapsible gate. But fort he purpose of this demo it will be energizing two LEDs and a Buzzer in Parallel. Therefore by implementing a simple SSR relay it can be deduced that if the LEDs and buzzers are energized , so will the gate. (because its the same terminal).

Once the Gate is alarmed the micro controller will send a message to the Main LCD tell the parent the alarm was sound and then wait for a HA user (Height Appropriate User ) to motion to a sensor that is taller than the average 5 year old. Once the sensor senses the motion the system will disarm.


include //Library for LCD Usage during the duration of this program

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // initialize the library with the numbers of the interface pins int count = 0; int sensor = 0; int HA_sensor = 0; int low = 95 ; int verify = 0; int adult =0;

int pinButton = 9; //the pin where we connect the button int LED = 13; //the pin we connect the LED

long readUltrasonicDistance(int pin) { pinMode(pin, OUTPUT); // Clear the trigger digitalWrite(pin, LOW); delayMicroseconds(2); // Sets the pin on HIGH state for 10 micro seconds digitalWrite(pin, HIGH); delayMicroseconds(10); digitalWrite(pin, LOW); pinMode(pin, INPUT); // Reads the pin, and returns the sound wave travel time in microseconds return pulseIn(pin, HIGH); } void setup() { lcd.begin(16, 2); // set up the LCD's number of columns and rows pinMode(9, INPUT);
pinMode(13, OUTPUT); //Set pins to 13 *controls both lights and push button pinMode(10, INPUT); pinMode(pinButton, INPUT); //set the button pin as INPUT pinMode(LED, OUTPUT); //set the LED pin as OUTPUT }

void loop() { digitalWrite(13,LOW); //Initialize OUTPUTS sensor = 0.01723 * readUltrasonicDistance(10);

if(sensor > low) { lcd.setCursor(0, 0); lcd.print("Stairs All clear."); delay(250); lcd.clear();

} else { digitalWrite(13,HIGH); lcd.setCursor(0, 0); lcd.print("System Armed"); delay(250); lcd.clear();



if(adult!= 0) { HA_sensor = 0.01723 * readUltrasonicDistance(9);

if(HA_sensor < low) { verify++; }

if(verify != 0) {

 digitalWrite(13, LOW);
lcd.setCursor(0, 0);
lcd.print(" System Disarmed.");

} }


Built With

Share this project: