@blh64 Many thanks for your help..... Your code without delay() is working perfectly.
But the flickering problem wasn't solved. I think delay is not take effect on screen update.
Redrawing the rectangle is the problem. How can I update the triangle without redrawing. This is the redrawing line:
for (byte i = menuStartAt; i < (menuStartAt + LCD_ROWS); i++) {
byte markerY = (i - menuStartAt) * MENU_ROW_HEIGHT;
if (i == menuPos) {
lcd.setTextColor(BLACK);
lcd.fillRect(0, markerY, lcd.width(), MENU_ROW_HEIGHT, GREEN);
}
else {
lcd.setTextColor(WHITE);
lcd.fillRect(0, markerY, lcd.width(), MENU_ROW_HEIGHT, BLACK);
}
if (i >= MENU_LENGTH)
continue;
lcd.setCursor(3, markerY + 2);
lcd.print((char*)pgm_read_word(&(menu[i])));
}