

If it's a temperature and don't need a lot of decimals, you could convert it to an integer (so just a couple of bytes, a simpler object to pass over) by multiplying the value by 10 and keep just the integer part: float temp = 24.351

When RPI receives that packet it just needs to rebuild the float, but I can't help you with that bc I've never used RPI, sorry.Ī simpler way is converting float to a string, as I said before, with a fixed structure to be interpreted back to a float. E.g., if you have a float representing a temperature to be sent to RPI, be like: Wire.write((uint8_t *) &temp, sizeof temp) You just specify a pointer to the float you want to send, followed by the number of bytes (4). byte arrays) over I2C with Wire.write(), you have everything you need. Serial.Hm, please keep in mind an Arduino float is actually stored as a 4-bytes value, so if you know how send bytes (i.e. Serial.print(digitalRead(PIN_SCL)) //should be HIGH Just put the GPIO (and SDA) to low for some time.ĭoesn't work to change the SDA pin directly to output and write LOW Parallel to a GPIO and check, if the error condition occurs. SDA data line held low ").Īnd want to share it in the first Google result: I connect SDA The SCL line was high, but SDA was being heldĮrror. Problem with a stuck I2C bus on startup (hangs at Well, it's an old issue, but i had the same

Update 1 st August 2017 – fix for error 3 (" I2Cīus error. With I2C_ClearBus.cpp and I2C_ClearBus.h files, modified to work with Nov 2022 – added link to I2C_ClearBus.zip Why the Arduino Wire library is not enough. Reliable Startup for I2C Battery Backed RTC Reliable Startup for I2C Battery Backed RTC Why the Arduino Wire library is not enough.
