Week 32. April 15.19 2019 - michelle-qin/Portfolio GitHub Wiki
I was sick and didn't go to school from April 15-17. At the DPEA, I worked on mapping out a state machine for the Ball Wall. Below is what I have so far.
3 modes/states: Initial, Active Button, Intermittent (inactive button) Variables: sensor1, sensor2, sensor3, 10s_timer
Initial ENTRY: power on • Set 10s_timer • If sensor3 does NOT detect metal - rotate Ball Gate until sensor3 detects metal
• If potentiometer is turned to 0 - move to Active Button state • else - move to Intermittent state
Active Button - throughout this state, check that potentiometer is turned to 0. If potentiometer is turned elsewhere, change to Initial state (where is will be redirected to Intermittent State). ENTRY: potentiometer is turned to 0 • If sensor1 detects metal - turn LED green - if button is pushed - start 10s_timer - turn LED red & make button inactive - rotate Ball Gate until sensor3 detects metal (180 deg - ball will release to other side) - if sensor2 detects metal - cycle complete - reset 10s_timer • Else - turn LED red & make button inactive
EXIT: - if potentiometer != 0 - reset 10s_timer - MOVE TO INITIAL STATE.
Intermittent - throughout this state, check that potentiometer is NOT turned to 0. If potentiometer is turned to 0, change to Initial state (where it will be redirected to Active State). ENTRY: potentiometer is NOT turned to 0 • Turn LED purple • Loop: Read potentiometer value - wait 15 seconds after potentiometer value stops changing - set interval time to potentiometer value - release ball - set timer for interrupt
EXIT: - if potentiometer = 0 - turn off timer - MOVE TO INITIAL STATE.