Nagito Sukegawa
/
Test_Brushless_Driver
2020 Off season development Test of brushless motor driver
Diff: main.cpp
- Revision:
- 0:710164f391d3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 12 15:20:04 2020 +0000 @@ -0,0 +1,29 @@ +#include "mbed.h" + +DigitalOut myled(LED1);//LED1,p26 +PwmOut led1(D7); +//Serial pc(D8,D2,115200); +Serial pc(USBTX,USBRX,115200); + +int main() +{ + led1.period_ms(20); + led1.pulsewidth_us(2000); + wait_ms(1); + led1.pulsewidth_us(1000); + wait_ms(1); + myled = 1; + wait(3); + while(1) { + myled=0; + for(int i = 1000; i < 2000; i+=10) { + led1.pulsewidth_us(i); + wait_ms(30); + } + for(int i = 2000; i > 1000; i-=10) { + led1.pulsewidth_us(i); + wait_ms(30); + } +// NVIC_SystemReset(); + } +}