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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers drawhands.h Source File

drawhands.h

00001 
00002 //early version of the analog clock draw function
00003 void draw_hands ( int x0 , int y0 , int r , float minutes , int hours , int color) 
00004    {
00005           int x1,y1,x2,y2;
00006           int rs = 0.6 * r ; // shorter moving hand
00007           int m = minutes ;  // minutes      
00008           int k = hours % 12;  // hours
00009           double angle2 = k * M_PI / 6 ; // scaling 
00010           double angle = m * M_PI / 30 ;
00011 
00012           x1 = r* sin(angle) + x0;//mins
00013           y1 = r * -cos(angle) + y0;
00014           x2 = rs * sin(angle2) + x0; //hours
00015           y2 = rs * -cos(angle2) + y0;
00016           TFT.line(x0, y0, x2, y2, color);
00017           TFT.line(x0, y0, x1, y1, color); 
00018 
00019   }
00020           
00021           
00022