![]() Attach a function to trigger when something is received. Start the I2C Bus as Slave on address 9 If (x > 5) x = 0 // `reset x once it gets 6Īnd here is the slave code that interprets the characters sent from the master: // Include the required Wire library for I2C#include Wire.endTransmission() // stop transmitting Wire.beginTransmission(9) // transmit to device #9 First, let's take a look at the master code: // Include the required Wire library for I2C#include Wire.The following code is split in two parts: the master code and the slave code, which run on two different Arduinos. Wire.write(val++) // sends potentiometer value byte Wire.write(byte(0x55)) // sends instruction byte Wire.beginTransmission(44) // transmit to device #44 (0x2c) Wire.begin() // join i2c bus (address optional for master) ![]() If I reduce the transmission to just the step #2 instruction single data byte, the same result is shown. The 2 data bytes are not being transmitted. The only byte I can see in my oscilloscope is just the first one (please see picture below).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |