Design a FSM that will turn on a fan and and LED when a correct code is entered,
ID: 1812831 • Letter: D
Question
Design a FSM that will turn on a fan and and LED when a correct code is entered, but will produce an audible sound ("alarm") if an incorrect code is entered.
1. Set DIO 7 to DIO 4 of the digital writer to store a random 4 bit code
2. Set DIO 3 to DIO 0 initially all to 0
3. Toggle DIO 0 on and off to reset the circuit. An LED will begin blinking at a rate of approximately twice per second and will remain blinking until four code bits are entered. Enter a code of length 4 bits as follows:
4. Set DIO 1 to 1 or 0 (next bit of your code) in the digital writer
5. Toggle DIO 2 on and off in the digital writer to enter this bit
6. Perform steps 4 and 5 three more times until the four code bits are entered
At this point, either a fan and LED will come on (correct code entered) or an audible sound will be produced by a loudspeaker (incorrect code entered). The LED can be the same one that was blinking, but it should now be on steadily. Alternatively, the blinking LED must go off, and another LED must come on. At any time the user can toggle DIO 0 on and off to reset the circuit and start over entering the code.
Explanation / Answer
http://www.eng.auburn.edu/~niuguof/2210labdev/html/final_project.html