I'm puzzles why the do...while loop does not end while the condition (0) is met. The slave i read the status of gives a 0 in return (tested this with output to monitor). Why?
do {
Wire.requestFrom(1, 1);
while (Wire.available()) {
int status_slave = Wire.read();
}
} while (status_slave != 0) ;
Thx TomGeorge. Stupdid mistake i didn't spot. I had declared the variable in the setup, but did it again in inside the inner while loop. That made it not function. Problem solved! Thx a lot!
TomGeorge:
Hi
Does the whole code compile?
You have declared the variable
int status_slave inside { },
so it is local to the code inside the { }
but you are using it outside the { } in the while command.
I think you should be declaring status_slave as a global variable.