Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: RTC-DS1307 SPI_TFT_ILI9341 TFT_fonts mbed tsi_sensor
Fork of TFT_Mikroelectronika_IL9341_sketchpad by
drawhands.h@37:54285105ed80, 2017-05-25 (annotated)
- Committer:
- tunagonen
- Date:
- Thu May 25 16:01:06 2017 +0000
- Revision:
- 37:54285105ed80
- Child:
- 38:3fe3bafbf0c7
added drawhands;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| tunagonen | 37:54285105ed80 | 1 | #include "libs.h" |
| tunagonen | 37:54285105ed80 | 2 | |
| tunagonen | 37:54285105ed80 | 3 | void draw_hands ( int x0 , int y0 , int r , float minutes , float hours , int color) |
| tunagonen | 37:54285105ed80 | 4 | { |
| tunagonen | 37:54285105ed80 | 5 | |
| tunagonen | 37:54285105ed80 | 6 | int rs = 0.8 * r ; // shorter moving hand |
| tunagonen | 37:54285105ed80 | 7 | int m = minutes ; |
| tunagonen | 37:54285105ed80 | 8 | int k = hours % 12; |
| tunagonen | 37:54285105ed80 | 9 | int angle2 = k * M_PI / 6 ; |
| tunagonen | 37:54285105ed80 | 10 | int angle = m * M_PI / 30 ; |
| tunagonen | 37:54285105ed80 | 11 | x1 = rs * cos(angle) + x0; |
| tunagonen | 37:54285105ed80 | 12 | y1 = rs * sin(angle) + y0; |
| tunagonen | 37:54285105ed80 | 13 | x2 = r * cos(angle2) + x0; |
| tunagonen | 37:54285105ed80 | 14 | y2 = r * sin(angle2) + y0; |
| tunagonen | 37:54285105ed80 | 15 | TFT.line(x0, y0, x2, y2, color); |
| tunagonen | 37:54285105ed80 | 16 | TFT.line(x0, y0, x1, y1, color); |
| tunagonen | 37:54285105ed80 | 17 | } |
| tunagonen | 37:54285105ed80 | 18 | |
| tunagonen | 37:54285105ed80 | 19 | |
| tunagonen | 37:54285105ed80 | 20 |
