BLDC main.cpp for BLDCmotorDriver

Dependencies:   BLDCmotorDriver RateLimiter mbed

Files at this revision

API Documentation at this revision

Comitter:
mslovic
Date:
Mon Jun 01 13:41:17 2015 +0000
Child:
1:aa6b6d379be4
Commit message:
First working version

Changed in this revision

BLDCmotorDriver.lib Show annotated file Show diff for this revision Revisions of this file
RateLimiter.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
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/BLDCmotorDriver.lib	Mon Jun 01 13:41:17 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/TVZ-Mechatronics-Team/code/BLDCmotorDriver/#7aae78b85e1d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RateLimiter.lib	Mon Jun 01 13:41:17 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/teams/TVZ-Mechatronics-Team/code/RateLimiter/#d735360f91f9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jun 01 13:41:17 2015 +0000
@@ -0,0 +1,30 @@
+#include "mbed.h"
+#include "RateLimiter.h"
+#include "BLDCmotorDriver.h"
+
+Serial pc(USBTX, USBRX);
+float dc = 0.0;
+BLDCmotorDriver M(p26, p24, p22, p25, p23, p21, p14, p17, p18, LED1);
+DigitalOut EN(p8);
+DigitalOut EN_BUCK(p28);
+
+int main() {
+  EN = 1;
+    pc.printf("Press 'w' to speed up, 's' to speed down\n\r");
+    while(true) { 
+
+      char c = pc.getc();
+        if((c == 'w') && (dc < 0.9)) {
+            dc += 0.1;
+        M.setDutyCycle(dc);
+        }
+        if((c == 's') && (dc > -0.9)) {
+            dc -= 0.1;
+        M.setDutyCycle(dc);
+        } 
+       
+ pc.printf("Duty Cycle: %1.2f, Sector: %d\n\r",dc, M.getSector());
+ 
+    }   
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jun 01 13:41:17 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/dbbf35b96557
\ No newline at end of file