![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Code to instruct the Nerf Gun to run
Diff: main.cpp
- Revision:
- 0:228a5306ccc7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 12 16:31:08 2018 +0000 @@ -0,0 +1,49 @@ +//For use with B22 "Excaliber" + +#include "mbed.h" +#include "stdio.h" + +int bullets = 10; + +DigitalOut load(p28); +DigitalOut spin(p27); + +DigitalOut spinled(LED1); +DigitalOut loadled(LED2); + +int main() +{ + while(bullets != 0) + { + //Reset + load = 0; + spin = 0; + + loadled = 0; + spinled = 0; + wait(5.0); + + //Start the spinner + spin = 1; + spinled = 1; + wait(2.0); + + for(; bullets > 0; bullets--) + { + //Load one disc + load = 1; + loadled = 1; + wait(0.5); + + load = 0; + loadled = 0; + //Turn off the spinner + wait(1.0); + } + + } +spin = 0; +load = 0; +spinled = 0; +loadled = 0; +}