I'm trying to do a project where several aggregated data sources are displayed on a LCD at regular intervals (500ms). I want to use a timer which breaks out of the main program loop to access the LCD to display this data. The strange thing is that it works OK to have the timer interrupt blink a LED on pin 13 at regular intervals, or have the timer interrupt print something on the serial output.
However as soon as I put a LCD function (lcd.print, lcd.clear, or anything else) the program 'freezes'.
I'm using the TimerThree library on an Arduino Mega. Below the bare minimal code which reproduces the problem:
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27,20,4);
lcd.setCursor(0,0); //when inserted this line no more blinking of LED and Serial output