Apologies for the weird subject line, but I'm having trouble narrowing down the exact problem.
I have a program running on an Arduino Nano to control an electric pump. It writes to a DAC (I2C) and an OLED (serial) as well as reading from a rotary encoder and tachometer signal (attached to an interrupt on D2).
The Arduino updates the OLED with input from the rotary encoder while occasionally printing to the serial monitor for troubleshooting.
On making certain edits and uploading the new code, the Arduino will "freeze":
-The OLED no longer updates with input from the rotary encoder
-Nothing appears on the serial monitor
The below snippet of code outputs the expected values to the serial monitor (with everything else working normally as well)
for(int i = 1; i <= 3; i++){
Serial.print(*(routines[2] + (i * 2 ) - 1));
Whereas replacing Serial.print() with Serial.println caused the "freezing" issue as previously described:
for(int i = 1; i <= 3; i++){
Serial.print(*(routines[2] + (i * 2 ) - 1));
I changed no part of the program other than this line. Uploading with the first snippet in void setup() resulted in normal behavior; uploading with the second snippet caused the "freezing" behavior. I went back and forth between the two versions with consistent results.
I tried cutting out different sections of code without being able to reproduce the issue, so I unplugged and went home. On restarting Arduino IDE, the problem went away; uploading either version of the program resulted in "normal behavior".
After making a few more edits the Arduino started freezing again. This time:
Code snippet that allows for normal behavior:
display.println("JZ Version 0.0"); display.println("Poly6 Technologies.");
Replacement snippet that causes freezing behavior:
display.println("JZ, Version 0.0"); display.println("Poly6 Technologies.");
The only difference is a comma in the string.
I've never come across an issue like this before. I tried looking up issues with Serial.print() but this seems too specific; the only lead I have is that no other edits have caused freezing behavior other than changes involving Serial.println() or display.println(). Has anyone had a similar issue or know where to begin troubleshooting?
I've uploaded my program in its entirety since I haven't been able to reliably replicate the issue other than in the previously mentioned situations.