Hall Sensor 6step BLDC

Dependencies:   mbed mbed-rtos

Files at this revision

API Documentation at this revision

Comitter:
oguro
Date:
Fri Aug 21 01:29:23 2020 +0000
Parent:
0:852c73d4e9a3
Commit message:
Trapezoid2

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 852c73d4e9a3 -r 234a28b98ee5 main.cpp
--- a/main.cpp	Wed Jun 21 04:02:00 2017 +0000
+++ b/main.cpp	Fri Aug 21 01:29:23 2020 +0000
@@ -100,13 +100,13 @@
  if((Vr_adc>0.15f)&&(q==0)){     
   while(q<50){   
     
-    mypwmA.write(0.5f);
-    mypwmB.write(0);
+    mypwmA.write(0);
+    mypwmB.write(0.5f);
     mypwmC.write(0);
     wait_ms(START);
            
-    mypwmA.write(0);
-    mypwmB.write(0.5f);
+    mypwmA.write(0.5f);
+    mypwmB.write(0);
     mypwmC.write(0);
     wait_ms(START);
          
@@ -118,12 +118,12 @@
       }
      } 
    
-        HA.rise(&HAH);
-        HC.fall(&HCL);
-        HB.rise(&HBH);
-        HA.fall(&HAL);
-        HC.rise(&HCH);
-        HB.fall(&HBL);
+        HA.rise(&HCH);  //HAH
+        HC.fall(&HBL);  //HCL
+        HB.rise(&HAH);  //HBH
+        HA.fall(&HCL);  //HAL
+        HC.rise(&HBH);  //HCH
+        HB.fall(&HAL);  //HBL
       //  s=0;
     if(Vr_adc < 0.1f){