2020 Off season development Test of brushless motor driver

Dependencies:   mbed

main.cpp

Committer:
st17099ng
Date:
2020-03-12
Revision:
0:710164f391d3

File content as of revision 0:710164f391d3:

#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();
    }
}