Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
image text in transcribed
- 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

Students also viewed these Databases questions