2-pole with spin-up from approx 5 Hz.. no manual control added yet

Dependencies:   mbed-STM32F103C8T6 mbed-rtos mbed

Files at this revision

API Documentation at this revision

Comitter:
MateyBoy
Date:
Tue Jun 19 17:44:44 2018 +0000
Commit message:
2 pole spin-up

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-STM32F103C8T6.lib Show annotated file Show diff for this revision Revisions of this file
mbed-rtos.lib 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 6082bcd0c94d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 19 17:44:44 2018 +0000
@@ -0,0 +1,66 @@
+#include "stm32f103c8t6.h"
+#include "mbed.h"
+#include "rtos.h"
+
+PwmOut mypwmled(PB_10);
+double per;
+DigitalOut  myled(LED1);
+AnalogIn sensepwm(PB_1);
+
+
+void q_bar() {
+    while (1) {
+        if (sensepwm.read() > 0.45) { // If the value is greater than 2V then toggle the LED
+          myled = 1;
+        }
+        else {
+          myled = 0;
+        }
+        
+        
+        }
+    }
+
+int main() {
+    mypwmled = 0.5;
+    mypwmled.period_ms(1000);
+    per = 1000;
+    Thread thread(q_bar);
+    while(per>40) {
+    
+  
+        mypwmled.period_us(per*1000);
+        //printf("LED is now %.2f\n", led.read());
+        
+        wait_ms(per*2+100);
+        per = per - 20;
+        
+        }
+
+    while (1) {
+         while(per<100) {
+    
+  
+        mypwmled.period_us(per*1000);
+        //printf("LED is now %.2f\n", led.read());
+        
+        wait_ms(per*2+100);
+        per = per + 3;
+        
+        }   
+        while(per>40) {
+    
+  
+        mypwmled.period_us(per*1000);
+        //printf("LED is now %.2f\n", led.read());
+        
+        wait_ms(per*3+100);
+        per = per - 3;
+        
+        } 
+    }
+
+    per = 1000;
+        mypwmled.period_us(per*1000);
+    
+}
\ No newline at end of file
diff -r 000000000000 -r 6082bcd0c94d mbed-STM32F103C8T6.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-STM32F103C8T6.lib	Tue Jun 19 17:44:44 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/hudakz/code/mbed-STM32F103C8T6/#727468adfd1d
diff -r 000000000000 -r 6082bcd0c94d mbed-rtos.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-rtos.lib	Tue Jun 19 17:44:44 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/mbed_official/code/mbed-rtos/#5713cbbdb706
diff -r 000000000000 -r 6082bcd0c94d mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 19 17:44:44 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file