A simple I2C library for ESCs using the Blue Robotics version of SimonK's TGY firmware (https://github.com/bluerobotics/tgy). This library supports the BlueESC, but also the Afro Nfet 30A. I2C is an alternative interface for micro-controllers, rather than using PWM (as a servo) -- this provides some additional features like temperature level, RPM, etc.

Dependents:   SimonK_I2C_ESC_Example

Example program here:

Import programSimonK_I2C_ESC_Example

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

Additional guidance is provided in the Wiki

Files at this revision

API Documentation at this revision

Comitter:
azazeal88
Date:
Sat Apr 02 11:44:14 2016 +0000
Parent:
3:d74e7df56379
Commit message:
Fixed RPM overflow issue because of timer

Changed in this revision

SimonK_I2C_ESC.cpp Show annotated file Show diff for this revision Revisions of this file
SimonK_I2C_ESC.h Show annotated file Show diff for this revision Revisions of this file
diff -r d74e7df56379 -r 014606ea57a3 SimonK_I2C_ESC.cpp
--- a/SimonK_I2C_ESC.cpp	Fri Apr 01 20:25:35 2016 +0000
+++ b/SimonK_I2C_ESC.cpp	Sat Apr 02 11:44:14 2016 +0000
@@ -41,7 +41,7 @@
     _temp_raw = (_buffer[4] << 8) | _buffer[5];
     _current_raw = (_buffer[6] << 8) | _buffer[7];
     _identifier = _buffer[8];
-    _rpm = float(_rpm) / (( mbed_rpm_timer.read_ms() -_rpmTimer)/1000.0f)*60/ float(_poleCount);
+    _rpm = float(_rpm) / (abs( mbed_rpm_timer.read_ms() -_rpmTimer)/1000.0f)*60/ float(_poleCount);
     _rpmTimer = mbed_rpm_timer.read_ms();
 }
 
diff -r d74e7df56379 -r 014606ea57a3 SimonK_I2C_ESC.h
--- a/SimonK_I2C_ESC.h	Fri Apr 01 20:25:35 2016 +0000
+++ b/SimonK_I2C_ESC.h	Sat Apr 02 11:44:14 2016 +0000
@@ -84,7 +84,7 @@
     char _address;
     unsigned short _voltage_raw, _current_raw, _temp_raw;
     short _rpm;
-    unsigned short _rpmTimer;
+    int _rpmTimer;
     Timer mbed_rpm_timer;
     char _identifier;
     char _poleCount;