LED/level code

Dependencies:   mbed 16october

Files at this revision

API Documentation at this revision

Comitter:
jkangwi
Date:
Thu Oct 16 19:24:43 2014 +0000
Parent:
1:9e0c8f9c58b8
Commit message:
dude

Changed in this revision

Servo.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.lib	Thu Oct 16 19:24:43 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Collinz-is-a-bo_17/code/16october/#dbe27b9db4c1
--- a/main.cpp	Thu Oct 16 19:13:59 2014 +0000
+++ b/main.cpp	Thu Oct 16 19:24:43 2014 +0000
@@ -1,4 +1,5 @@
 #include "mbed.h"
+#include "Motor.h"
 
 DigitalIn sw1(p16);
 DigitalIn sw2(p17);
@@ -14,30 +15,39 @@
 int switch4=sw4;
 int switch5=sw5;
 
+Motor poof(p26,p29,p30);
+
 int main()
 {
+    float motspeed=0.34;
     LED=1;
     while(1) {
+        
         while (switch1==1) {
             LED=rand()%65;
             wait(.5);
+            poof.speed(motspeed);
         }
         while (switch2==1) {
             LED=rand()%65;
             wait(.2);
+            poof.speed(motspeed+0.01);
         }
         while (switch3==1) {
             LED=rand()%65;
             wait(.1);
+            poof.speed(motspeed+0.02);
         }
         while (switch4==1) {
             LED=rand()%65;
             wait(.05);
+            poof.speed(motspeed+0.03);
         }
         while (switch5==1) {
             LED=rand()%65;
-        wait(.03);
-        }
+            wait(.03);
+            poof.speed(motspeed+0.1);
+        } 
     }