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

Dependencies:   mbed-STM32F103C8T6 mbed-rtos mbed

Revision:
0:6082bcd0c94d
--- /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