I have a program where I am displaying a message every x seconds (the message pops up), is there a way for the message to stay a little bit on the screen, because there is no time for the user to read it properly.
your guidance is much appreciated.
below is a piece of my code where I am using millis().
if (millis() - timer >= 4000) //random message every 4 seconds
{
if(user11.equals(rev_film1[0]))
{
app.text(user11, 15,490);
app.text(rat_film1[0] + " / 10",100,550);
timer = millis();
}
else if(user11.equals(rev_film1[1]))
{
app.text(user11, 15,490);
app.text(rat_film1[1] + " / 10",100,550);
timer = millis();
}
else if(user11.equals(rev_film1[2]))
{
app.text(user11, 15,490);
app.text(rat_film1[2] + " / 10",100,550);
timer = millis();
}
else if(user11.equals(rev_film1[3]))
{
app.text(user11, 15,490);
app.text(rat_film1[3] + " / 10",100,550);
timer = millis();
}
}
Think about how you would know when to show and hide the square. What is the value of timer
when you want to show and hide the square? What is the value of millis()
?
Write out a few examples of timelines, something like this:
millis = 0: program start
millis >= 4000: show message
millis >= 6000: hide message
Then use this timeline as a guide for when you want stuff to happen, and map this to the variables in your sketch.
If you're having trouble, please post a MCVE (not your entire sketch, but not a disconnected snippet either) in a new question post and we'll go from there. Good luck.