Pseudo Code
Dependencies: mbed Motor Servo
main.cpp
- Committer:
- msilver
- Date:
- 2018-10-09
- Revision:
- 1:d90f940d6ed2
- Parent:
- 0:3c51dfd71129
- Child:
- 2:b4a690fadc9b
File content as of revision 1:d90f940d6ed2:
/*Project 2 – Mechatronics – MIDN Dietrich, Schwind, Silver*/ //Libraries #include "mbed.h" #include "stdio.h" #include "stdlib.h" /* Declare servos, motors, and switches 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 */ int main() { /* 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? */ }