uint32_t value = 99999;
lcd.clear(); lcd.setPosition(0,1); lcd.printf("Writing bytes 0-16\n");
i2c.start();
data[0] = 0;
data[1] = 0;
data[2] = ((value >> 24) & 0xFF);
i2c.write(0xA0, data, 3);
wait (0.1);
data[0] = 0;
data[1] = 1;
data[2] = ((value >> 16) & 0xFF);
i2c.write(0xA0, data, 3);
wait (0.1);
data[0] = 0;
data[1] = 2;
data[2] = ((value >> 8) & 0xFF);
i2c.write(0xA0, data, 3);
wait (0.1);
data[0] = 0;
data[1] = 3;
data[2] = (value & 0xFF);
i2c.write(0xA0, data, 3);
wait (0.1);
//READ //Setting read pointer to 0 value = 0; data[0] = 0; // MSB address data[1] = 0; // LSB address
i2c.write(0xA0, data, 2);
char response[4]; i2c.read(0xA0+0x01, response, 4); value = ((response[0]<<24) | (response[1]<<16) | (response[2]<<8) | response[3]);
lcd.clear(); lcd.setPosition(0,0); lcd.printf("%d", value); wait(5);