Contains the main execution of the clock uses headers to import functions

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of TFT_Mikroelectronika_IL9341_sketchpad by Oxford CWM Team

Files at this revision

API Documentation at this revision

Comitter:
tunagonen
Date:
Thu May 25 16:01:06 2017 +0000
Parent:
32:56f59b79720c
Child:
38:3fe3bafbf0c7
Commit message:
added drawhands;

Changed in this revision

drawhands.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drawhands.h	Thu May 25 16:01:06 2017 +0000
@@ -0,0 +1,20 @@
+#include "libs.h"
+
+void draw_hands ( int x0 , int y0 , int r , float minutes , float hours , int color) 
+   {
+          
+          int rs = 0.8 * r ; // shorter moving hand
+          int m = minutes ;        
+          int k = hours % 12; 
+          int angle2 = k * M_PI / 6 ;
+          int angle = m * M_PI / 30 ;
+          x1 = rs * cos(angle) + x0;
+          y1 = rs * sin(angle) + y0;
+          x2 = r * cos(angle2) + x0;
+          y2 = r * sin(angle2) + y0;
+          TFT.line(x0, y0, x2, y2, color);
+          TFT.line(x0, y0, x1, y1, color); 
+  }
+          
+          
+    
\ No newline at end of file