CQ_KIT_Ver1_5
Dependencies: mbed RateLimiter BLDCmotorDriverCQ_KIT_Ver1_5
main.cpp
- Committer:
- mslovic
- Date:
- 2015-06-01
- Revision:
- 0:24b227524f2d
- Child:
- 2:4ae769d0b112
File content as of revision 0:24b227524f2d:
#include "mbed.h" #include "RateLimiter.h" #include "BLDCmotorDriver.h" Serial pc(USBTX, USBRX); float dc = 0.0; BLDCmotorDriver M(p26, p24, p22, p25, p23, p21, p14, p17, p18, LED1); DigitalOut EN(p8); DigitalOut EN_BUCK(p28); int main() { EN = 1; pc.printf("Press 'w' to speed up, 's' to speed down\n\r"); while(true) { char c = pc.getc(); if((c == 'w') && (dc < 0.9)) { dc += 0.1; M.setDutyCycle(dc); } if((c == 's') && (dc > -0.9)) { dc -= 0.1; M.setDutyCycle(dc); } pc.printf("Duty Cycle: %1.2f, Sector: %d\n\r",dc, M.getSector()); } }