Pseudo Code

Dependencies:   mbed Motor Servo

main.cpp

Committer:
msilver
Date:
2018-10-09
Revision:
0:3c51dfd71129
Child:
1:d90f940d6ed2

File content as of revision 0:3c51dfd71129:

#include "mbed.h"

/*Project 2 – Mechatronics – MIDN Dietrich, Schwind, Silver*/
/*Hardware
Servo 1 – rotates hand between palm facing up and palm facing in
Servo 2 – inside jar to burst pb out
Motor – drive arm from 90 degrees to forehead
Switch 1 – in palm (when pb jar is put in the hand, hits the switch to activate the servo on the hand)
Switch 2 – on forehead (turn motor off)
Switch 3 – on lid? (when you put the contents back in the jar it signals arm to start moving back down to starting position?)
Switch 4 – on (desk?) to signal the motor to stop when arm reaches starting position
 
//Software
Hand starts with palm facing in
Jar into hand
Hits switch that turns servo on to turn the hand to position where palm is facing up
Motor drives arm from elbow at 90 degrees up to forehead (hit switch to turn motor off)
(I don’t know if this next step will happen as a result of the same switch that turned the motor off or with a different switch)
Random number (Russian roulette) if the jar will open or not
            Rand_Max / (int) random //random integer 0 or 1
/*This next section depends on if the random number is 0 or 1*/
If open (read 1):
When switch is hit to turn motor off? Servo inside jar turns on to break the lid and make pb fall out
Speaker will go off saying “beat Army”
When user puts contents back in the jar and lid on, hits a switch (when lid goes back on?) that turns the motor on to return the arm to the original position
When switch 4 is hit, motor will turn off
Servo 1 will turn on (with the same switch that turned motor off if possible) returning the hand to the original position
If stay closed (read 0):
            Servo inside pb jar will not turn on
            Speaker will say “boo”
--switch will not be hit when lid goes back (since it never came off) so will the user have to manually move the arm back to the starting position? Will they press the button on the lid so the motor turns on?



int main() {

    }
}