Welcome to the forum.
In the Arduino IDE, press Ctrl+R.
Or use the menu : Tools / Auto Format
After that, check every line, every space, every comma, every indent, and make it look even better.
Which Arduino boards do you use ?
Is that a photo of a simulation ? I don't recognize it. What is it ?
You could start with the Master only.
Add the State Change Detection and show in the Serial Monitor an increasing number, either 0,1,2 or 1,2,3.
Only after you are sure that the button and the counting is working, then you can use the I2C bus.
And wire your button up properly... One side to ground, the other to your arduino pin. Then declare it as INPUT_PULLUP in setup(). It will read HIGH when not pressed and LOW when pressed. This eliminates the need for an external pull-up/pull-down resistor.
assuming receive() returns an integer, why are you comparing "x" to HIGH?
are there several devices with different addresses?
won't this only ever send a value of "1"
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.