An Automated External Defibrillator (AED) is used in first aid ere someone has had a heart attack and needs to be kept alive until an ambulance arrives.
You will design and build a simulation of an AED.
1. The device should be able to detect whether the patient's heart is beating normally (display a green light) or whether it has stopped beating (display a red light). Simulate this with a :witch or other hardware (so for example if the switch is being pressed, the patient's heart has stopped, and if the switch is not being ressed, the heartbeat is normal).
2. If the device detects that the patient's heart is not beating, it should warn bystanders to stand clear and after ten seconds apply an "electric shock.'
3. If after step 2 the heart is still not beating, it should ask the user to start delivering CPR - simulate this by rePeatedlY Pressing a button. Monitor (and possibly display( the rate at which the button is being pressed - between one and two presses per second is the correct rate. Warn the user if the button is being pressed too quickly or too slwly.
4. After 30 seconds of CPR, go to step 2 again, and repeat until the heart starts beating.
You may like to incorporate other inputs and outputs - we have a limited supply of LCD displays, 7-segment LED displays, keypads. You should also look at the example (in the C Programming folder) of how to implement a state transition diagram.