![](/media/cache/profiles/a8806a7fa519efb09f5e1d662957418e.jpg.50x50_q85.jpg)
Simple example for the SimonK_I2C_ESC. Tested on the FRDM K64F.
Dependencies: SimonK_I2C_ESC mbed
Diff: main.cpp
- Revision:
- 0:f30c4157d617
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Apr 01 07:11:15 2016 +0000 @@ -0,0 +1,32 @@ +#include "mbed.h" +#include "SimonK_I2C_ESC.h" + +#define ESC_ADDRESS 0x2B + +I2C i2c(D14, D15); +SimonK_I2C_ESC motor(i2c, ESC_ADDRESS); +Serial pc(USBTX, USBRX); + +int main() { + i2c.frequency (400); + motor.set(0); + while(true){ + + motor.update(); + pc.printf("ESC: "); + + if(motor.isAlive()) pc.printf("OK\t\t"); + else pc.printf("NA\t\t"); + + pc.printf("%d",motor.rpm());pc.printf(" RPM\t\t"); + pc.printf("%f",motor.voltage());pc.printf(" V\t\t"); + pc.printf("%f",motor.current());pc.printf(" A\t\t"); + pc.printf("%f",motor.temperature());pc.printf(" `C"); + pc.printf("\n\r"); + + wait_ms(250); + //motor.set(10); + + + } +} \ No newline at end of file