akiyoshi oguro
/
Nucleo_Hall_BLDC_rpm
Hall Sensor 6step BLDC
Diff: main.cpp
- Revision:
- 1:cfa36edc2232
- Parent:
- 0:852c73d4e9a3
- Child:
- 2:7a89b67efc84
diff -r 852c73d4e9a3 -r cfa36edc2232 main.cpp --- a/main.cpp Wed Jun 21 04:02:00 2017 +0000 +++ b/main.cpp Sat Jun 01 04:09:00 2019 +0000 @@ -1,7 +1,7 @@ #include "mbed.h" #include "rtos.h" -unsigned int q=0,r=0,s=0,START=8; +unsigned int q=0,r=0,s=0,START=8;//8 PwmOut mypwmA(PA_8); //PWM_OUT PwmOut mypwmB(PA_9); //PWM_OUT @@ -100,30 +100,30 @@ if((Vr_adc>0.15f)&&(q==0)){ while(q<50){ - mypwmA.write(0.5f); - mypwmB.write(0); - mypwmC.write(0); + mypwmA.write(0.0); //0.5 + mypwmB.write(0.5f); + mypwmC.write(0.0); wait_ms(START); - mypwmA.write(0); - mypwmB.write(0.5f); - mypwmC.write(0); + mypwmA.write(0.0); + mypwmB.write(0.0);//0.5 + mypwmC.write(0.5f); wait_ms(START); - mypwmA.write(0); - mypwmB.write(0); - mypwmC.write(0.5f); + mypwmA.write(0.5f); + mypwmB.write(0.0); + mypwmC.write(0.0); //0.5 wait_ms(START); q++; } } - HA.rise(&HAH); - HC.fall(&HCL); - HB.rise(&HBH); - HA.fall(&HAL); - HC.rise(&HCH); - HB.fall(&HBL); + HA.rise(&HBH); + HC.fall(&HAL); + HB.rise(&HCH); + HA.fall(&HBL); + HC.rise(&HAH); + HB.fall(&HCL); // s=0; if(Vr_adc < 0.1f){