Simple Function Crashing Arduino?

Hi,
Can you please post a circuit diagram showing how you have the two UNO's connected?

I don't see a Serial.begin in your code, so you aren't checking data values on your IDE monitor.
Can I suggest you do, and place Serial.println statements at strategic parts of your code, to indicate the status of the variables you are using to make your code function?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia: