Dear All,
I want to control my I2C ESC from my mbed uC. Before I use mbed, I use ATmega uC. This is my AVR code to drive the ESC:
// Make actual write to I2C bus
Wire.beginTransmission(0x28 + 3); // transmit to device ADDRESS
Wire.send(30); // sends one byte command
Wire.endTransmission(); // stop transmitting
I try to replace that task by mbed using this code:
#include "mbed.h"
I2C i2c(p9, p10);
int const addr = 0x31; //address of ESC
int main() {
char bl_1[2];
while(1) {
bl_1[0] = 0x00;
bl_1[1] = 30;
i2c.write(addr, bl_1, 2);
wait(0.05);
}
}
But it is not works...
Please help me, is there anything wrong with the code??
Thank you,
Raharja
Dear All,
I want to control my I2C ESC from my mbed uC. Before I use mbed, I use ATmega uC. This is my AVR code to drive the ESC:
// Make actual write to I2C bus Wire.beginTransmission(0x28 + 3); // transmit to device ADDRESS Wire.send(30); // sends one byte command Wire.endTransmission(); // stop transmittingI try to replace that task by mbed using this code:#include "mbed.h" I2C i2c(p9, p10); int const addr = 0x31; //address of ESC int main() { char bl_1[2]; while(1) { bl_1[0] = 0x00; bl_1[1] = 30; i2c.write(addr, bl_1, 2); wait(0.05); } }But it is not works...Please help me, is there anything wrong with the code??
Thank you,
Raharja