Orologio digitale 1

Utilizza i metodi second(), minute() e hour() per acquisire l’orario, nf() per formattare i dati su due cifre e text() per scrivere testo in modalità grafica

PFont FONT;
float testoY;
int   testoX1,
      testoX2,
      testoX3;

void setup()
{
  size(500, 50);
  frameRate(5);  
  FONT=loadFont("C48.vlw"); 
  textFont(FONT);
  textAlign(CENTER);
  testoX1=width/4;
  testoX2=2*testoX1;
  testoX3=3*testoX1; 
  testoY=0.8*height;
}

void draw()
{
  background(200);
  fill(0,   0, 255); text(nf(  hour(), 2), testoX1, testoY);
  fill(255, 0, 255); text(nf(minute(), 2), testoX2, testoY);
  fill(255, 0,   0); text(nf(second(), 2), testoX3, testoY);
}