Escolar Documentos
Profissional Documentos
Cultura Documentos
/*
Elevator project with arduino pro mini 328 5v 8mhz - This is a simple
elevator project using a single-phase ac motor. - There are 3 floors and a
button is placed in every floor and are connected in paraller with 3 button
inside the elevator. - 3 proximity switches are attached on every floor to
indicate where the elevator is and to stop it. - A buzzer is connected to
warn for movement or -alarm stop inside the elevator is attached directly to
the reset button. code by:Fanis Katmadas site:oramasolutions.com
fanisk@oramasolutions.com */
const int floor1 = 7;//proximity switch attached on floor1 const int floor2 =
6;//proximity switch attached on floor2 const int floor3 = 5;//proximity switch
attached on floor3 const int callbutton1 = 4;//push button on the floor1 and
in paraller the button for floor 1 in the elevator const int callbutton2 =
3;//push button on the floor2 and in paraller the button for floor 2 in the
elevator const int callbutton3 = 2;//push button on the floor3 and in paraller
the button for floor 3 in the elevator const int relayup = 12;//the relay that
drives up the elevator const int relaydown=10;//the relay that drives down
the elevator const int buzzer = 11;//a buzzer warning movement or alarm
stop const int poweron=13;
// the setup routine runs once when you press reset: void setup()
// the loop routine runs over and over again forever: void loop()
//start by checking the 3 call buttons. //we read the input and if we have
signal we wait for the release before starting. //after the release a pause of
a second is added before beggining the motion of the elevator if
(callelevator1 == HIGH)// if the floor 1 call button is pressed {
delay(200);//software debounce of the button while(callelevator1 == HIGH)
{ callelevator1 = digitalRead(callbutton1);//check the value of the button
again delay(10);//keep running smoothly }//wait for the relese of the button
to continue delay(1000); floor1function();//go to the floor 1 fuction of the
elevator } else if(callelevator2 == HIGH)// if the floor 2 call button is pressed
{ delay(200); //software debounce of the button while(callelevator2 ==
HIGH) { callelevator2 = digitalRead(callbutton2);//check the value of the
button again delay(10);//keep running smoothly }//wait for the relese of the
button to continue delay(1000); floor2function();//go to the floor 2 fuction of
the elevator } else if(callelevator3 == HIGH)// if the floor 1 call button is
pressed { delay(200); //software debounce of the button while(callelevator3
== HIGH) { callelevator3 = digitalRead(callbutton3);//check the value of the
button again delay(10);//keep running smoothly }//wait for the relese of the
button to continue delay(1000); floor3function();//go to the floor 3 fuction of
the elevator } digitalWrite(relayup, LOW); //keep the relay for up motion
inactive digitalWrite(relaydown, LOW); //keep the relay for down motion
inactive digitalWrite(buzzer, LOW);//keep the buzzer quite delay(10);//a few
delay just to keep running smoothly }
void floor2function() {
}}
}}