Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 0:2c78f6dc3dea, committed 2017-03-11
- Comitter:
- hankpkai
- Date:
- Sat Mar 11 23:40:59 2017 +0000
- Commit message:
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor.lib Sat Mar 11 23:40:59 2017 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/simon/code/Motor/#f265e441bcd9
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Mar 11 23:40:59 2017 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+#include "Motor.h"
+
+//DigitalOut led(LED1);
+DigitalIn sw1(p5);
+DigitalIn sw2(p6);
+BusOut led(LED1,LED2,LED3,LED4);
+Motor m(p21, p11, p12); // pwm, fwd, rev
+
+int main() {
+ led = 0;
+ m.speed(0);
+ int count = 3;
+ float speed = 0;
+ while(1) {
+
+ if(sw1 == 0 && count < 5)
+ {
+ count ++;
+ speed +=0.5;
+ m.speed(speed);
+ if(count == 3)
+ led =0;
+ else if (count == 1)
+ led = 0x1;
+ else if (count == 2)
+ led = 0x2;
+ else if (count == 4)
+ led = 0x4;
+ else if (count == 5)
+ led = 0x8;
+ wait(1);
+
+ }
+
+ else if(sw2 == 0 && count>0 )
+ {
+ count --;
+ speed -=0.5;
+ m.speed(speed);
+ if(count == 3)
+ led =0;
+ else if (count == 1)
+ led = 0x1;
+ else if (count == 2)
+ led = 0x2;
+ else if (count == 4)
+ led = 0x4;
+ else if (count == 5)
+ led = 0x8;
+
+ wait(1);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Mar 11 23:40:59 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e1686b8d5b90 \ No newline at end of file