![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
affichage calendrier
main.cpp@0:c2359ca01ec0, 2021-06-07 (annotated)
- Committer:
- altaber
- Date:
- Mon Jun 07 08:09:48 2021 +0000
- Revision:
- 0:c2359ca01ec0
calendrier
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altaber | 0:c2359ca01ec0 | 1 | #include <mbed.h> |
altaber | 0:c2359ca01ec0 | 2 | #include "F746_GUI.hpp" |
altaber | 0:c2359ca01ec0 | 3 | |
altaber | 0:c2359ca01ec0 | 4 | #include "fonction.h" |
altaber | 0:c2359ca01ec0 | 5 | |
altaber | 0:c2359ca01ec0 | 6 | |
altaber | 0:c2359ca01ec0 | 7 | int main(void) |
altaber | 0:c2359ca01ec0 | 8 | { |
altaber | 0:c2359ca01ec0 | 9 | int h=23; // je mets la valeur de l'angle |
altaber | 0:c2359ca01ec0 | 10 | |
altaber | 0:c2359ca01ec0 | 11 | Label obj10(240, 2, "SEXTANT: Altaber Perez", Label::CENTER, Font16); |
altaber | 0:c2359ca01ec0 | 12 | |
altaber | 0:c2359ca01ec0 | 13 | // JOUR DE L ANNEE _________________________________________________________________ |
altaber | 0:c2359ca01ec0 | 14 | |
altaber | 0:c2359ca01ec0 | 15 | const int NUMBER_BUTTONS1 = 31; |
altaber | 0:c2359ca01ec0 | 16 | const string STR1[NUMBER_BUTTONS1] = {"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"}; |
altaber | 0:c2359ca01ec0 | 17 | ButtonGroup Jour(15 ,30, 15, 15, NUMBER_BUTTONS1, STR1, 2, 2, 11, 1, |
altaber | 0:c2359ca01ec0 | 18 | Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF); |
altaber | 0:c2359ca01ec0 | 19 | Label obj11(2, 7, "Jour", Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 20 | |
altaber | 0:c2359ca01ec0 | 21 | // MOIS DE L ANNEE _________________________________________________________________ |
altaber | 0:c2359ca01ec0 | 22 | |
altaber | 0:c2359ca01ec0 | 23 | Label obj12(2, 110, "Mois", Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 24 | |
altaber | 0:c2359ca01ec0 | 25 | const int NUMBER_BUTTONS2 = 12; |
altaber | 0:c2359ca01ec0 | 26 | const string STR2[NUMBER_BUTTONS2] = {"Jan", "Fev", "Mar", "Avr","Mai", "Juin","Juill","Aou","Sep","Oct","Nov","Dec"}; |
altaber | 0:c2359ca01ec0 | 27 | ButtonGroup Mois(10,130, 40, 20, NUMBER_BUTTONS2, STR2, 2, 2, 6, 1, |
altaber | 0:c2359ca01ec0 | 28 | Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF); |
altaber | 0:c2359ca01ec0 | 29 | |
altaber | 0:c2359ca01ec0 | 30 | |
altaber | 0:c2359ca01ec0 | 31 | // HEURE ___________________________________________________________________________ |
altaber | 0:c2359ca01ec0 | 32 | |
altaber | 0:c2359ca01ec0 | 33 | Label obj13(270, 35, "Heure minutes", Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 34 | const int NUMBER_BUTTONS3 = 23; |
altaber | 0:c2359ca01ec0 | 35 | const string STR3[NUMBER_BUTTONS3] = {"01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"}; |
altaber | 0:c2359ca01ec0 | 36 | ButtonGroup Heure(270, 60, 15, 15, NUMBER_BUTTONS3, STR3, 2, 2,5, 1, |
altaber | 0:c2359ca01ec0 | 37 | Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF); |
altaber | 0:c2359ca01ec0 | 38 | |
altaber | 0:c2359ca01ec0 | 39 | Label obj14(2, 7, "Jour", Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 40 | const int NUMBER_BUTTONS4 = 60; |
altaber | 0:c2359ca01ec0 | 41 | const string STR4[NUMBER_BUTTONS4] = {"00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59"}; |
altaber | 0:c2359ca01ec0 | 42 | ButtonGroup Minutes(360, 60, 15, 15, NUMBER_BUTTONS4, STR4, 2, 2, 7, 1, |
altaber | 0:c2359ca01ec0 | 43 | Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF); |
altaber | 0:c2359ca01ec0 | 44 | |
altaber | 0:c2359ca01ec0 | 45 | |
altaber | 0:c2359ca01ec0 | 46 | //OK______________________________________________________ |
altaber | 0:c2359ca01ec0 | 47 | Button valide(360, 224, 50, 30, "Valider"); |
altaber | 0:c2359ca01ec0 | 48 | |
altaber | 0:c2359ca01ec0 | 49 | |
altaber | 0:c2359ca01ec0 | 50 | while (true) |
altaber | 0:c2359ca01ec0 | 51 | { |
altaber | 0:c2359ca01ec0 | 52 | int num=0; |
altaber | 0:c2359ca01ec0 | 53 | int a=0 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12; |
altaber | 0:c2359ca01ec0 | 54 | int mois; |
altaber | 0:c2359ca01ec0 | 55 | int jour; |
altaber | 0:c2359ca01ec0 | 56 | int heure; |
altaber | 0:c2359ca01ec0 | 57 | int minute; |
altaber | 0:c2359ca01ec0 | 58 | if (Jour.GetTouchedNumber(a)) { |
altaber | 0:c2359ca01ec0 | 59 | jour=Jour.GetTouchedNumber()+1;} |
altaber | 0:c2359ca01ec0 | 60 | if (Heure.GetTouchedNumber(a)) { |
altaber | 0:c2359ca01ec0 | 61 | heure= Heure.GetTouchedNumber();} |
altaber | 0:c2359ca01ec0 | 62 | if (Minutes.GetTouchedNumber(a)) { |
altaber | 0:c2359ca01ec0 | 63 | minute= Minutes.GetTouchedNumber();} |
altaber | 0:c2359ca01ec0 | 64 | if (Mois.GetTouchedNumber(a)){ |
altaber | 0:c2359ca01ec0 | 65 | mois=Mois.GetTouchedNumber()+1;} |
altaber | 0:c2359ca01ec0 | 66 | if (valide.Touched()==true){ |
altaber | 0:c2359ca01ec0 | 67 | if (mois==1){ |
altaber | 0:c2359ca01ec0 | 68 | num=jour;} |
altaber | 0:c2359ca01ec0 | 69 | if (mois==2){ |
altaber | 0:c2359ca01ec0 | 70 | num=jour+31;} |
altaber | 0:c2359ca01ec0 | 71 | if (mois==3){ |
altaber | 0:c2359ca01ec0 | 72 | num=jour+59;} |
altaber | 0:c2359ca01ec0 | 73 | if (mois==4){ |
altaber | 0:c2359ca01ec0 | 74 | num=jour+90;} |
altaber | 0:c2359ca01ec0 | 75 | if (mois==5){ |
altaber | 0:c2359ca01ec0 | 76 | num=jour+120;} |
altaber | 0:c2359ca01ec0 | 77 | if (mois==6){ |
altaber | 0:c2359ca01ec0 | 78 | num=jour+151;} |
altaber | 0:c2359ca01ec0 | 79 | if (mois==7){ |
altaber | 0:c2359ca01ec0 | 80 | num=jour+182;} |
altaber | 0:c2359ca01ec0 | 81 | if (mois==8){ |
altaber | 0:c2359ca01ec0 | 82 | num=jour+212;} |
altaber | 0:c2359ca01ec0 | 83 | if (mois==9){ |
altaber | 0:c2359ca01ec0 | 84 | num=jour+243;} |
altaber | 0:c2359ca01ec0 | 85 | if (mois==10){ |
altaber | 0:c2359ca01ec0 | 86 | num=jour+273;} |
altaber | 0:c2359ca01ec0 | 87 | if (mois==11){ |
altaber | 0:c2359ca01ec0 | 88 | num=jour+304;} |
altaber | 0:c2359ca01ec0 | 89 | if (mois==12){ |
altaber | 0:c2359ca01ec0 | 90 | num=jour+334;} |
altaber | 0:c2359ca01ec0 | 91 | float declinaison=asin(sin(23.45*(3.141592/180))*sin(((360/365.25)*(num-79))*(3.141592/180))); |
altaber | 0:c2359ca01ec0 | 92 | declinaison= (180/3.141592)*declinaison; |
altaber | 0:c2359ca01ec0 | 93 | int latitude= 90+declinaison-h; |
altaber | 0:c2359ca01ec0 | 94 | char lat[16]; |
altaber | 0:c2359ca01ec0 | 95 | char dec[16]; |
altaber | 0:c2359ca01ec0 | 96 | char j[16]; |
altaber | 0:c2359ca01ec0 | 97 | char m[16]; |
altaber | 0:c2359ca01ec0 | 98 | itoa(latitude, lat, 10); |
altaber | 0:c2359ca01ec0 | 99 | itoa(declinaison, dec, 10); |
altaber | 0:c2359ca01ec0 | 100 | itoa(num,j, 10); |
altaber | 0:c2359ca01ec0 | 101 | itoa(mois,m, 10); |
altaber | 0:c2359ca01ec0 | 102 | BSP_LCD_Clear(LCD_COLOR_DARKBLUE); |
altaber | 0:c2359ca01ec0 | 103 | Label obj15(240, 2, "SEXTANT: Altaber Perez", Label::CENTER, Font16); |
altaber | 0:c2359ca01ec0 | 104 | Label obj16(100, 100, "latitude = ", Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 105 | Label obj17(220, 100, lat, Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 106 | Label obj18(100, 130, dec, Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 107 | Label obj19(100, 170, j, Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 108 | Label obj20(100, 200, m, Label::LEFT, Font16); |
altaber | 0:c2359ca01ec0 | 109 | wait(0.02f); |
altaber | 0:c2359ca01ec0 | 110 | |
altaber | 0:c2359ca01ec0 | 111 | } |
altaber | 0:c2359ca01ec0 | 112 | } |
altaber | 0:c2359ca01ec0 | 113 | } |