Class Project
Rumfinator
Posts: 1
My partner and I are building a school project. The point of the project is to create a simulated battle field. We will have 14 toy soldiers that sit on a small foam constructed battlefield. Each soldier will sit above a plastic tube. The plastic tubes are connected to a 24v 24 output pneumatic manifold. Each input from the pneumatic manifold is controlled by an output from a demulitplexer (which is controlled by the basic stamp).
What we want to do is program the basic stamp in the following manor:
1) Star button enables program
2)Random generator will generate a number between 1-14
3)whichever number is picked will set of a if/then statement that goes to a sub program
4)that sub program will enable the corresponding pneumatic manifold input.
5)That then sends a puff of air under the corresponding soldier to launch them into the air.
6)This will continue to happen until one team of 7 is completely eliminated.
7)That will trigger one more sub program to play the winning teams victory song through one of our four speakers.
8)DONE!
My main question is 1) Is this doable with a random generator? 2)There are going to be many in/then statements, is there a command that can condense this?
P.S. My partner and I just started to learn about the Basic stamp a few weeks ago and we are not experienced programmers. Any direction would actually be excellent!
What we want to do is program the basic stamp in the following manor:
1) Star button enables program
2)Random generator will generate a number between 1-14
3)whichever number is picked will set of a if/then statement that goes to a sub program
4)that sub program will enable the corresponding pneumatic manifold input.
5)That then sends a puff of air under the corresponding soldier to launch them into the air.
6)This will continue to happen until one team of 7 is completely eliminated.
7)That will trigger one more sub program to play the winning teams victory song through one of our four speakers.
8)DONE!
My main question is 1) Is this doable with a random generator? 2)There are going to be many in/then statements, is there a command that can condense this?
P.S. My partner and I just started to learn about the Basic stamp a few weeks ago and we are not experienced programmers. Any direction would actually be excellent!
Comments
2) There's no way to directly condense IF / THEN without actually simplifying the choices involved. Statements like LOOKUP, LOOKDOWN, SELECT can all help simplify a program. Sometimes using small arrays can help. It depends on the details.
3) There are lots of tutorials on Parallax's website. From the main page, click on the Resources tab, then Downloads, then Stamps in Class Downloads. A good starting point is the "What's a Microcontroller?" tutorial. Also look through the Nuts and Volts Columns. The index is off the Resources tab as well.