Some of the codes run repeatedly, the rest don't run at all

Hello all,

I'm new to the whole Arduino stuff. I'm trying to undertand the usage of Arduino UNO with LCD 5110. I planned to display a basic picture, and succesfully been able to do it. And then I wanted to clear the screen and print some words. So I want this:

  1. The picture comes up and stays on the 5110 for couple of seconds,
  2. The picture disappears and a string comes up istead of it.

"#include <LCD5110_Graph.h>

LCD5110 lcd(8,9,10,11,12);

extern uint8_t icon[];
extern uint8_t SmallFont[];

void setup()
{
lcd.InitLCD();
}

void loop()
{
lcd.clrScr();
lcd.drawBitmap (0,0, icon, 84, 48);
lcd.update();

delay(2000);

lcd.clrScr();
lcd.setFont(SmallFont);
lcd.print("STRING", CENTER, 20);
lcd.update();
}
"
So the problem is, the picture succesfully comes up, but after it stays 2 second like I wanted, it's just re-appearing. So I never see "STRING" on the screen but the picture over and over again. Thank you for your help in advance!

The code in loop() runs repeatedly. When you display the text, your code reaches the end of loop, then continues at the beginning of loop, clearing the text and re-displaying the image. Put another delay() after displaying the text so you have time to see it.

You need another delay at the end of loop.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.