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
Diff: SimonK_I2C_ESC.cpp
- Revision:
- 1:7efb04a9c0dd
- Parent:
- 0:41ddae212f64
- Child:
- 4:014606ea57a3
diff -r 41ddae212f64 -r 7efb04a9c0dd SimonK_I2C_ESC.cpp --- a/SimonK_I2C_ESC.cpp Fri Apr 01 06:45:10 2016 +0000 +++ b/SimonK_I2C_ESC.cpp Fri Apr 01 06:58:04 2016 +0000 @@ -5,7 +5,7 @@ } SimonK_I2C_ESC::SimonK_I2C_ESC(I2C &i2c, char address, char poleCount) : _i2c(i2c){ - _address = address; + _address = address << 1; _poleCount = poleCount; // A timer is needed to calculate the RPM. mbed_rpm_timer.start(); @@ -25,7 +25,7 @@ throttleData[0] = 0x00; // Throttle Start Address throttleData[1] = throttle>>8; throttleData[2] = throttle; - _i2c.write(_address, throttleData, 3, true); + _i2c.write(_address, throttleData, 3, false); } // Send motor speed command to ESC