Hi there i m trying to work on i2c code, can someone help how to code i2c to transmit 5 data like below, thx.
uint8_tTxdata[6] = {0x1,0x2,0x3,0x4,0x5,0x6};
Hi there i m trying to work on i2c code, can someone help how to code i2c to transmit 5 data like below, thx.
uint8_tTxdata[6] = {0x1,0x2,0x3,0x4,0x5,0x6};
Which Arduino you are using?
In the IDE, click on File->Examples->Wire->master_writer
That sketch shows the basics on how to use I2C to send data.
For more information go here
Following onto the above advice here is an example, this initializes a DS1307 RTC to 11:55:00 AM.
uint8_t DSinit[3] = {0x00, 0x55, 0x51};
Wire.beginTransmission(DS1307Addr);
Wire.write(0x00); // Write starting register
Wire.write(DSinit,3); // Write 3 values to DS1307 sequential registers
Wire.endTransmission();
I do not know what you are writing to, but writing to sequential registers must be enabled/available.
I m using UNO as master to send 6 bytes of data out using i2c, to STM32H7 as slave.. STM32 i2c will receive these 6 bytes of data without triggering the NACK response...
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.