Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLDCmotorDriver RateLimiter mbed
main.cpp
00001 #include "mbed.h" 00002 #include "RateLimiter.h" 00003 #include "BLDCmotorDriver.h" 00004 00005 Serial pc(USBTX, USBRX); 00006 float dc = 0.0; 00007 BLDCmotorDriver M(p26, p24, p22, p25, p23, p21, p14, p17, p18, LED1); 00008 DigitalOut EN(p8); 00009 DigitalOut EN_BUCK(p28); 00010 00011 int main() { 00012 EN = 1; 00013 pc.printf("Press 'w' to speed up, 's' to speed down\n\r"); 00014 while(true) { 00015 00016 char c = pc.getc(); 00017 if((c == 'w') && (dc < 0.9)) { 00018 dc += 0.1; 00019 M.setDutyCycle(dc); 00020 } 00021 if((c == 's') && (dc > -0.9)) { 00022 dc -= 0.1; 00023 M.setDutyCycle(dc); 00024 } 00025 00026 pc.printf("Duty Cycle: %1.2f, Sector: %d\n\r",dc, M.getSector()); 00027 00028 } 00029 } 00030
Generated on Fri Jul 22 2022 13:17:16 by
1.7.2