Hi,
I'm trying to run and update 2 displays using U8G2lib independently of the main program loop using intervalTimer, but this seems to be blocking the main loop or stops it running after the first pass.
Can anyone cast an eye and see what I'm doing wrong, pretty please?
I'm trying to run and update 2 displays using U8G2lib independently of the main program loop using intervalTimer, but this seems to be blocking the main loop or stops it running after the first pass.
Can anyone cast an eye and see what I'm doing wrong, pretty please?
Code:
#include <SPI.h>
#include "U8g2lib.h"
IntervalTimer Displays_Run;
U8G2_SSD1306_128X32_UNIVISION_1_HW_I2C Main_Display(U8G2_R0, SCL, SDA, U8X8_PIN_NONE);
U8G2_SSD1306_64X32_1F_1_SW_I2C Sub_Display(U8G2_R0, 16, 17, U8X8_PIN_NONE);
void setup() {
Serial.begin(9600);
while (!Serial && millis() < 2000) ; // wait
Serial.println("Blah..");
Main_Display.begin();
Main_Display.clearDisplay();
Main_Display.firstPage();
do {
Main_Display.setDisplayRotation(U8G2_R2);
Main_Display.setFont(u8g_font_10x20r);
Main_Display.drawStr(0, 13, "1");
} while ( Main_Display.nextPage() );
Sub_Display.begin();
Sub_Display.clearDisplay();
Sub_Display.firstPage();
do {
Sub_Display.setFont(u8g_font_10x20r);
Sub_Display.drawStr(0, 15, "2");
} while ( Sub_Display.nextPage() );
delay(1000);
Displays_Run.begin(Sub_Display_Run, 2500);
Displays_Run.priority(250);
}
void loop() {
Serial.println("TEST");
delay(250);
}
void Sub_Display_Run()
{
Sub_Display.firstPage();
do {
Sub_Display.setFont(u8g_font_10x20r);
Sub_Display.drawStr(0, 15, "3");
} while ( Sub_Display.nextPage() );
}