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.h
- Revision:
- 2:8adc426cbe31
- Parent:
- 0:41ddae212f64
- Child:
- 3:d74e7df56379
--- a/SimonK_I2C_ESC.h Fri Apr 01 06:58:04 2016 +0000 +++ b/SimonK_I2C_ESC.h Fri Apr 01 20:18:41 2016 +0000 @@ -1,4 +1,4 @@ -/* SimonK I2C ESC Control Library +/** SimonK I2C ESC Control Library ------------------------------------------------ Title: Mbed I2C ESC Library @@ -49,34 +49,34 @@ class SimonK_I2C_ESC { public: - /* Constructor for ESC instance. Requires input of I2C address (ESC 0,1...16 is address + /** Constructor for ESC instance. Requires input of I2C address (ESC 0,1...16 is address * 0x29,0x2A...0x39). Optionally accepts pole count for RPM measurements. T100 is 6 and * T200 is 7. */ SimonK_I2C_ESC(I2C &_i2c, char address, char poleCount = 6); - /* Sends updated throttle setting for the motor. Throttle input range is 16 bit + /** Sends updated throttle setting for the motor. Throttle input range is 16 bit * (-32767 to +32767). */ void set(short throttle); - /* Alternate function to set throttle using standard servo pulse range (1100-1900) */ + /** Alternate function to set throttle using standard servo pulse range (1100-1900) */ void setPWM(short pwm); - /* The update function reads new data from the ESC. */ + /** The update function reads new data from the ESC. */ void update(); - /* Returns true if the ESC is connected */ + /** Returns true if the ESC is connected */ bool isAlive(); - /* Returns voltage measured by the ESC in volts */ + /** Returns voltage measured by the ESC in volts */ float voltage(); - /* Returns current measured by the ESC in amps */ + /** Returns current measured by the ESC in amps */ float current(); - /* Returns temperature measured by the ESC in degree Celsius */ + /** Returns temperature measured by the ESC in degree Celsius */ float temperature(); - /* Returns RPM of the motor. Note that this measurement will be + /** Returns RPM of the motor. Note that this measurement will be * more accurate if the I2C data is read slowly. */ short rpm();