BLDC control for jumping robot.

Dependencies:   CRC MODSERIAL mbed-dev mbed-rtos

Fork of mbed_BLDC_driver_KL25Z by Duncan Haldane

main.cpp

Committer:
dhaldane
Date:
2016-03-05
Revision:
0:00c56a9c6dee
Child:
1:d68c51a0a706

File content as of revision 0:00c56a9c6dee:

#include "mbed.h"
#include "enc.h"

Ticker RTI;
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX); // tx, rx
enc crankPos(p5,p6,p7,p8);


void get_state(){
    crankPos.update_pos();
}

int main() {    
    RTI.attach(&get_state, 0.01);
    while(1) {
        myled = 1;
        wait(0.05);
        pc.printf("Encoder: %u                             \r\n", crankPos.cal_state());
        myled = 0;
        wait(0.05);
    }
}