Pseudo Code

Dependencies:   mbed Motor Servo

Committer:
msilver
Date:
Tue Oct 09 14:32:44 2018 +0000
Revision:
0:3c51dfd71129
Child:
1:d90f940d6ed2
Project 2 Code ; 1st Draft

Who changed what in which revision?

UserRevisionLine numberNew contents of line
msilver 0:3c51dfd71129 1 #include "mbed.h"
msilver 0:3c51dfd71129 2
msilver 0:3c51dfd71129 3 /*Project 2 – Mechatronics – MIDN Dietrich, Schwind, Silver*/
msilver 0:3c51dfd71129 4 /*Hardware
msilver 0:3c51dfd71129 5 Servo 1 – rotates hand between palm facing up and palm facing in
msilver 0:3c51dfd71129 6 Servo 2 – inside jar to burst pb out
msilver 0:3c51dfd71129 7 Motor – drive arm from 90 degrees to forehead
msilver 0:3c51dfd71129 8 Switch 1 – in palm (when pb jar is put in the hand, hits the switch to activate the servo on the hand)
msilver 0:3c51dfd71129 9 Switch 2 – on forehead (turn motor off)
msilver 0:3c51dfd71129 10 Switch 3 – on lid? (when you put the contents back in the jar it signals arm to start moving back down to starting position?)
msilver 0:3c51dfd71129 11 Switch 4 – on (desk?) to signal the motor to stop when arm reaches starting position
msilver 0:3c51dfd71129 12
msilver 0:3c51dfd71129 13 //Software
msilver 0:3c51dfd71129 14 Hand starts with palm facing in
msilver 0:3c51dfd71129 15 Jar into hand
msilver 0:3c51dfd71129 16 Hits switch that turns servo on to turn the hand to position where palm is facing up
msilver 0:3c51dfd71129 17 Motor drives arm from elbow at 90 degrees up to forehead (hit switch to turn motor off)
msilver 0:3c51dfd71129 18 (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)
msilver 0:3c51dfd71129 19 Random number (Russian roulette) if the jar will open or not
msilver 0:3c51dfd71129 20 Rand_Max / (int) random //random integer 0 or 1
msilver 0:3c51dfd71129 21 /*This next section depends on if the random number is 0 or 1*/
msilver 0:3c51dfd71129 22 If open (read 1):
msilver 0:3c51dfd71129 23 When switch is hit to turn motor off? Servo inside jar turns on to break the lid and make pb fall out
msilver 0:3c51dfd71129 24 Speaker will go off saying “beat Army”
msilver 0:3c51dfd71129 25 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
msilver 0:3c51dfd71129 26 When switch 4 is hit, motor will turn off
msilver 0:3c51dfd71129 27 Servo 1 will turn on (with the same switch that turned motor off if possible) returning the hand to the original position
msilver 0:3c51dfd71129 28 If stay closed (read 0):
msilver 0:3c51dfd71129 29 Servo inside pb jar will not turn on
msilver 0:3c51dfd71129 30 Speaker will say “boo”
msilver 0:3c51dfd71129 31 --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?
msilver 0:3c51dfd71129 32
msilver 0:3c51dfd71129 33
msilver 0:3c51dfd71129 34
msilver 0:3c51dfd71129 35 int main() {
msilver 0:3c51dfd71129 36
msilver 0:3c51dfd71129 37 }
msilver 0:3c51dfd71129 38 }