Code to instruct the Nerf Gun to run

Dependencies:   mbed

Files at this revision

API Documentation at this revision

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
--- /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;
+}
--- /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