Hi,
I have a master-slave communication between two Arduino Mega boards (through i2C). The master sends a command to the slave in order to perform a given tasks. The system works when I open the Serial Monitor window from both Arduino boards. I mean, I open two Arduino IDE instances with their respective COM acquiring the data from USB cables. However, if I unplug the slave from the PC, while the master still is connected to the PC, the system does not work. The code in the slave includes an initialization of variables before the void setup() - with function configurations and void loop() - running the board-.
If I move the variable initialization inside the void setup(), I get errors because the variables inside the void loop() are not declared. How can I run the system if the slave is not connected directly to the PC?
My goal is to acquire all data just plugging the master to the pc uniquely (keeping the i2C communication with the slave).
If you need additional information, I can add it.
Thanks