Question: please write in C - Draw the state diagram for the garage door. - Implement the code - You must implement it with an infinite

please write in C  please write in C - Draw the state diagram for the
garage door. - Implement the code - You must implement it with

- Draw the state diagram for the garage door. - Implement the code - You must implement it with an infinite do while - You must have a state variable ( always an integer) - your code must have a switch statement with as many cases as states. - The switch statement should be on the state variable not on the sensor values. - The trigger conditions should be implemented within the cases usina if else if else statements. You are given the task to automate a house garage door. The door has the following components: - 1 push button (named push_b) that triggers the motion of the door. - 1 sensor (named obst) that detects obstructions (obst =1 when there is an obstruction, 0 otherwise). - 1 limit switch (named s_cl) that detects that the door is fully closed. (s_cl =1 if door is fully closed, 0 otherwise). - 1 limit switch (named s_op) that detects that the door is fully open (s_op =1 if the door is fully open, 0 otherwise). The behavior of the door should be the following: - If the door is closed and push_b is pressed, the door should open. If the door is opening or closing and push_b is pressed, the door should reverse direction. - If the door is fully open, there are no obstructions and push_ b is pressed, the door should close. -If there is an obstruction and the door is in the process of being closed, it should reverse direction and go towards the open position

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!