Want A door open and close using 8051

Status
Not open for further replies.

friendchooser

Newbie level 5
I want to open a door to be opened with 89c51 as after 90 degree the motor should be of automatically and after A smaalll delay it should close the door
Code:
#include <reg51.h>
void MSDelay(unsigned int);
void main(void)
{

P1=0x55;
MSDelay(15);
P1=0xAA;
MSDelay(15);

}
void MSDelay(unsigned int itime)
{
unsigned int i,j;
for (i=0;i<itime;i++)
for (j=0;j<80;j++);
}

this is the circuit i am using and the motor does not stops
plz give an urgent suggestion or ammendments in the code

---------- Post added at 01:26 ---------- Previous post was at 01:25 ----------

The frequency i am giving is through the microcontroller

friendchooser

Newbie level 5
when the person enters his face will be detected and the door open automatically and after some delay the door will be closed

okay...take this example.. you will have basic Idea based in this example..

Code C - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void main()
{
face_detected = 0;
door_open = 0;
while(1)
{
if(face_detected == 1)
{
door_open = 1
delay_sec(5);
face_detected = 0
}
door_close = 1;
}
}

nandhu015

It is better to have a sensor at open and close position. Use a limit switch.

thannara123

Points: 2