Design a smart room with following features:
- If a person is inside a room and pushes the button, light will be turned on until the fan makes 5 oscillations and then will be turned off.
- If a person is not inside the room, and pushes on the button, the light will be turned on only until one oscillation of the fan.
- However, the user can override the 2nd condition by long pressing the button. In this case, point no. 1 will be valid.
Equivalents in this circuit:
- Here, inside the room means, the person is in the range of 30-100cm of an ultrasonic sensor.
- Light is an LED bulb
- Fan is a servo motor. One oscillation means going from 0-180degree and again returning to zero degrees.
- Long press means that the button is pressed for more than 3 seconds.
Note:
- Make a neat circuit with clear connections.
- Do not put more than one wire in one Arduino pin. Use a breadboard if needed.