Go Down

Topic: display graphics + txt on hdmi monitor this way less blinking ( timer + subs ) (Read 437 times) previous topic - next topic

tenij000

here is code 

long previousMillis = 0;  
long intersensor3 = 5000; // delay time
//--------------------------

#include "VidorGraphics.h"
#include "Vidor_GFX.h"
//----------------------------------
int x=100;
int y=100;
//----------------------------------
Vidor_GFX  vdgfx;

void setup() {
  Serial.begin(9600);

  
delay(4000);
  // Initialize the FPGA
  if (!FPGA.begin()) {
    Serial.println("Initialization failed!");
    while (1) {}
  }

  delay(4000);
  //-------------------------------------------------- wit achtergrond ------------------------
 vdgfx.fillRect(0,0,640,480,vdgfx.White());
//-------------------------------------------------------------------------------------------
}

void loop()
{
 unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > intersensor3) {
  previousMillis = currentMillis;  
  //---------------------------------------------------------- delay 
 graphics();
 text();
 //----------------------------------------------------------  delay
 }
 //----------------------------------------------------------normal time


//----------------------------------------------------------normal time
}

void text()

{
  vdgfx.text.setCursor(150,375);
  vdgfx.text.setAlpha(255);
  vdgfx.text.setSize(3);
  vdgfx.text.setColor(vdgfx.lightBlue());
  vdgfx.println("hoi zaterdag");
  vdgfx.println(x);
  vdgfx.text.setCursor(0,145);
  vdgfx.text.setSize(1);
  vdgfx.text.setColor(vdgfx.Red());
  vdgfx.println("info regel om dat het kan");

}


void graphics()
{
 vdgfx.fillCircle(225,225,100 ,vdgfx.lightBlue());
 vdgfx.fillCircle(415,225,100 ,vdgfx.lightBlue());
 vdgfx.fillCircle(225,225,90 ,vdgfx.White());
  vdgfx.fillCircle(415,225,90 ,vdgfx.White());
 vdgfx.fillRect(175,220,100,10 ,vdgfx.lightBlue());
 vdgfx.fillRect(365,220,100,10 ,vdgfx.lightBlue());
 vdgfx.fillRect(410,175,10,100 ,vdgfx.lightBlue());
vdgfx.fillRect(410,175,x,y ,vdgfx.Blue());
 
vdgfx.drawLine(300, 0, 400, 400, vdgfx.Green());
vdgfx.drawLine(100, 0, 400, 400, vdgfx.White());
vdgfx.drawRect(10, 10, 100, 100, vdgfx.Red());
vdgfx.drawCircle(225,225,100 ,vdgfx.lightBlue());

}

Limba

To get rid of blinking FPGA should implement double buffering. One where you draw and one that is displayed.

Go Up