Project in progress
VidorClock

VidorClock © GPL3+

Simple clock with MKR Vidor 4000

  • 2,246 views
  • 0 comments
  • 2 respects

Components and supplies

About this project

Simple MKR Vidor 4000 demo clock

Code

VidorClockC/C++
#include "VidorGraphics.h"
#include "Vidor_GFX.h"

Vidor_GFX  vdclk;
//drawClock();
int x = 0;
int y = 0;
int prev_sec;
void setup() {
  Serial.begin(9600);

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

void loop()
{
 for (int sec = 0; sec < 60; sec++){ 
  x = 320 + 130 * sin(prev_sec *0.1048); 
  y = 280 - 130 * cos(prev_sec * 0.1048); 
  vdclk.drawLine(320, 280, x, y, vdclk.White(),1);
  
  x = 320 + 130 * sin(sec *0.1048); 
  y = 280 - 130 * cos(sec * 0.1048); 
  vdclk.drawLine(320, 280, x, y, vdclk.Red(),1);
  prev_sec = sec;
  delay(1000); 
 }

}

void drawClockFace(){
 // Fill the screen with a white background
 vdclk.fillRect(0,0,640,480,vdclk.White(),1);
 //Draw the clock face
 vdclk.fillCircle(320,280,150 ,vdclk.lightBlue(),1);
 vdclk.fillCircle(320,280,140 ,vdclk.White(),1);
 vdclk.fillCircle(320,280,20 ,vdclk.lightBlue(),1);

 for (int m = 0; m < 360; m = m + 30){
      int x = 0;
      int y = 0;
      x = 320 + 140 * sin(m *0.0175); 
      y = 280 - 140 * cos(m * 0.0175);  
      vdclk.fillRect(x,y,4,4,vdclk.Red(),1);
 }
}

Comments

Similar projects you might like

RGB Large Digital Clock

Project in progress by Mark Daniel Belarmino

  • 22,749 views
  • 11 comments
  • 54 respects

O'Clock

Project in progress by vikonix

  • 21,762 views
  • 76 comments
  • 44 respects

Energy Data Logger

Project in progress by Javi D'Ambra

  • 20,813 views
  • 7 comments
  • 37 respects

Air Compressor Controller ver.2

Project in progress by tomwyonkman

  • 15,810 views
  • 31 comments
  • 54 respects

Sensal - All Senses Alarm Clock

Project in progress by Leonid Piliptsevich

  • 15,478 views
  • 2 comments
  • 31 respects

Digital Clock

Project in progress by Team SharKode

  • 16,509 views
  • 6 comments
  • 36 respects
Add projectSign up / Login