Question
a)Draw a flowchart to carry out the following operation. A microcontroller has digital inputs from a mechanical switch door sensor and an electronic motion sensor.
a)Draw a flowchart to carry out the following operation. A microcontroller has digital inputs from a mechanical switch door sensor and an electronic motion sensor. The input from the door sensor is 1 for door closed and 0 for door opened. The input from the motion sensor is 0 when no motion is detected, and 1 if a motion is detected. It also has an output that powers up a light which needs to be 0 for off and 1 for on. The light should come on only if it has been detected that the door is open and a motion is detected, and remain on for 2 minutes. After that the light is turned off and the process begins again. You should take switch bounce into consideration where necessary. (b) Write some C code which implements this flowchart for an Arduino Due board. Write only the loop() function provided by Arduino, and assume that the setup function has already been correctly defined and that global variables for the sensor and light pins already exist. You should choose suitable names for the variables. (c) Draw a diagram showing how the mechanical switch door sensor can be connected to a microcontroller, avoiding any floating input. Describe the operation of the circuit you have drawn.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started