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: SimonK_I2C_ESC mbed
main.cpp
00001 #include "mbed.h" 00002 #include "SimonK_I2C_ESC.h" 00003 00004 #define ESC_ADDRESS 0x2B 00005 00006 I2C i2c(D14, D15); 00007 SimonK_I2C_ESC motor(i2c, ESC_ADDRESS); 00008 Serial pc(USBTX, USBRX); 00009 00010 int main() { 00011 i2c.frequency (400); 00012 motor.set(0); 00013 while(true){ 00014 00015 motor.update(); 00016 pc.printf("ESC: "); 00017 00018 if(motor.isAlive()) pc.printf("OK\t\t"); 00019 else pc.printf("NA\t\t"); 00020 00021 pc.printf("%d",motor.rpm());pc.printf(" RPM\t\t"); 00022 pc.printf("%f",motor.voltage());pc.printf(" V\t\t"); 00023 pc.printf("%f",motor.current());pc.printf(" A\t\t"); 00024 pc.printf("%f",motor.temperature());pc.printf(" `C"); 00025 pc.printf("\n\r"); 00026 00027 wait_ms(250); 00028 //motor.set(10); 00029 00030 00031 } 00032 }
Generated on Wed Jul 27 2022 23:48:03 by
1.7.2