Simple example for the SimonK_I2C_ESC. Tested on the FRDM K64F.

Dependencies:   SimonK_I2C_ESC mbed

Files at this revision

API Documentation at this revision

Comitter:
azazeal88
Date:
Fri Apr 01 07:11:15 2016 +0000
Commit message:
Added comments

Changed in this revision

SimonK_I2C_ESC.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SimonK_I2C_ESC.lib	Fri Apr 01 07:11:15 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/azazeal88/code/SimonK_I2C_ESC/#7efb04a9c0dd
--- /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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Apr 01 07:11:15 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/99a22ba036c9
\ No newline at end of file