![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Code to instruct the Nerf Gun to run
Revision 0:228a5306ccc7, committed 2018-02-12
- Comitter:
- cjedwardz
- Date:
- Mon Feb 12 16:31:08 2018 +0000
- Commit message:
- Version 0
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 228a5306ccc7 main.cpp --- /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; +}
diff -r 000000000000 -r 228a5306ccc7 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 12 16:31:08 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e \ No newline at end of file