After a few days of struggling with this I thought I would ask on here for help.
The program I am making should reads signals from 3 sensors and print them out in the serial log. Now the program works fine if the iterators (see code) only read one sensor, I can leave it for hours quite happily running without any stops. If I change the iterators to have 2 or 3 loops and read multiple sensors then after a random amount of time the arduino simply stops serialising data. Im confident that the 3 sensors are working as the logs appear correct and it correctly displays different data for each of the sensors. When the arduino stops reporting data the lights remain on (see code I blink the led and this no longer blinks but either stays on or off) and pressing the reset button immediately makes the system run again until it stops after a few minutes.
I think I can rule out a memory issue as ive added the memoryfree.h library and it logged out the same memory value for the entire duration up to the point where it stopped.
I also think its not a power issue as ive set it up at different USB ports and still has the same behaviour.
For some reason I cant quite understand how increasing the iterator makes the program fall over but not immediately. The code is a bit messy as I am not going to clean it up until its working properly.
Any pointers or ideas would be amazing
Edit: Wont let me post the code due to character limit so ive attached it.
MPU6050_DMP6_3_sensors.ino (15.3 KB)