Cannot use variables sent via I2C in my slaves void loop

I decided to use i2c to connect two arduinos to split the load between them. The master will receive data from an esp8266 wi-fi module and transmit it to the slave that will use that data as a reference point for a PİD controller. But i cannot use the received data. İt's stuck in the void receiveEvent(howMany) function. Any idea on how the call an int received from there into the main void loop? I'm sure it's a very noob questions, but I've searched for days and couldn't find an answer or example that uses the void loop. Thanks

Sounds like a variable scope problem. It's difficult to tell from your description though.

Show us the code. :slight_smile:

Sounds like a variable scope problem.

I think you're probably declaring the received variable inside receiveEvent()- if so you could try declaring it at the top of the slave sketch. That way it will be visible to loop().