IoT Ox / Mbed 2 deprecated MainSketch Featured

Dependencies:   RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor

Fork of TFT_Mikroelectronika_IL9341_sketchpad by Oxford CWM Team

drawhands.h

Committer:
tunagonen
Date:
2017-05-26
Revision:
39:4b70d28cb273
Parent:
38:3fe3bafbf0c7
Child:
41:3f2e75e7fbeb

File content as of revision 39:4b70d28cb273:


//early version of the analog clock draw function
void draw_hands ( int x0 , int y0 , int r , float minutes , int hours , int color) 
   {
          int x1,y1,x2,y2;
          int rs = 0.6 * r ; // shorter moving hand
          int m = minutes ;  // minutes      
          int k = hours % 12;  // hours
          double angle2 = k * M_PI / 6 ; // scaling 
          double angle = m * M_PI / 30 ;
          x1 = rs * sin(angle) + x0; // trigonometric functions to get values
          y1 = rs * cos(angle) + y0;
          x2 = r * sin(angle2) + x0;
          y2 = r * cos(angle2) + y0;
          TFT.line(x0, y0, x2, y2, color); //draw line
          TFT.line(x0, y0, x1, y1, color); //draw line
  }