#include "mbed.h" #define I2C_ARDUINO_ADDR (0x08 << 1) // 8bit address I2C I2cArduino(PB_9, PB_8); // SDA, SCL int main() { I2cArduino.frequency(400000); uint8_t x = 0; while(1) { if (I2cArduino.write(I2C_ARDUINO_ADDR, "x is ", 5, true) != 0) { printf("I2C failure"); } if (I2cArduino.write(I2C_ARDUINO_ADDR, (char *)&x, 1) != 0) { printf("I2C failure"); } x++; wait_ms(500); } }