Project in progress
VidorClock

VidorClock © GPL3+

Simple clock with MKR Vidor 4000

  • 15 views
  • 0 comments
  • 0 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

Clock Arduino Nano NeoPixel Ring Alarm/Timer Function

Project in progress by WannaDuino

  • 11,620 views
  • 21 comments
  • 45 respects

Sensal - All Senses Alarm Clock

Project in progress by Leonid Piliptsevich

  • 8,783 views
  • 2 comments
  • 28 respects

Talking Clock 2 - New Version (Bilingual: EN-PT)

Project in progress by LAGSILVA

  • 9,226 views
  • 21 comments
  • 37 respects

Digital Clock

Project in progress by Team SharKode

  • 6,906 views
  • 4 comments
  • 26 respects

Tri-Mode Digital Clock With ATtiny85 And RTC

Project in progress by LAGSILVA

  • 6,252 views
  • 0 comments
  • 21 respects

Arduino 24h Binary Clock with Seconds (17 LEDs)

Project in progress by Peter Lunk

  • 3,401 views
  • 8 comments
  • 16 respects
Add projectSign up / Login