bonjour
j'ai réussi à faire drawLine en fonction de l'angle et je fais la simulation du soleil bitmap avec drawBitmap
mais la j'ai un soucis il fonctionne de tant en temp
mon code n'es surement pas bon , pourriez vous m'aider s'il vous plait
j'ai fait un switch case pour simuler la course du soleil
d'avance merci .
void draw2(void){
DateTime now = RTC.now();
u8g.firstPage();
do {
u8g.setFont(u8g_font_6x10);
u8g.setPrintPos(2,10);
u8g.print("SunAngle");
u8g.setPrintPos(55,62);
u8g.print(EEPROM.read(13));
angle = (EEPROM.read(13));
u8g.drawLine(20, 50, 110, 50);
u8g.drawCircle(x0, y0, r, U8G_DRAW_UPPER_RIGHT);
u8g.drawCircle(x0, y0, r, U8G_DRAW_UPPER_LEFT);
u8g.drawLine(x0,y0,x0-r*cos(1*angle*2*3.14/360),y0-r*sin(1*angle*2*3.14/360));
CalcSun ();
myLord.SunRise(sunTime);
myLord.SunSet(sunTime);
TimeMins = (now.hour() * 60) + now.minute();
uint16_t time = now.hour() * 60 + now.minute();
uint16_t angle = map(time, Sunrise, Sunset, 0, 180);
if(angle < 0)
angle = 0;
else if(angle > 180)
angle = 180;
if(angle==0 ) {sun=1;}
if(angle==10) {sun=2;}
if(angle==20) {sun=3;}
if(angle==30) {sun=4;}
if(angle==40) {sun=5;}
if(angle==50) {sun=6;}
if(angle==60) {sun=7;}
if(angle==70) {sun=8;}
if(angle==80) {sun=9;}
if(angle==90) {sun=10;}
if(angle==100){sun=11;}
if(angle==110){sun=12;}
if(angle==120){sun=13;}
if(angle==130){sun=14;}
if(angle==140){sun=15;}
if(angle==150){sun=16;}
if(angle==160){sun=17;}
if(angle==170){sun=18;}
if(angle==180){sun=19;}
switch(sun){
case 1:
u8g.drawXBMP(23,41,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 2:
u8g.drawXBMP(23,35,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 3:
u8g.drawXBMP(25,30,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 4:
u8g.drawXBMP(28,25,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 5:
u8g.drawXBMP(30,20,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 6:
u8g.drawXBMP(35,15,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 7:
u8g.drawXBMP(40,10,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 8:
u8g.drawXBMP(46,9,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 9:
u8g.drawXBMP(51,8,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 10:
u8g.drawXBMP(57,7,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 11:
u8g.drawXBMP(64,7,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 12:
u8g.drawXBMP(69,8,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 13:
u8g.drawXBMP(74,10,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 14:
u8g.drawXBMP(80,15,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 15:
u8g.drawXBMP(85,18,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 16:
u8g.drawXBMP(88,24,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 17:
u8g.drawXBMP(90,29,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 18:
u8g.drawXBMP(92,35,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
case 19:
u8g.drawXBMP(93,41,u8g_logo_width, u8g_logo_height, u8g_sun_3_bits);
break;
u8g.setFont(u8g_font_6x10);
u8g.setPrintPos(5,62);
if(EEPROM.read(9)<10);
u8g.print("0");
u8g.print(EEPROM.read(9));
u8g.print (":");
if (EEPROM.read(10) <10)
u8g.print("0");
u8g.print (EEPROM.read(10));
u8g.setPrintPos(95,62);
if(EEPROM.read(11)<10)
u8g.print("0");
u8g.print (EEPROM.read(11));
u8g.print (":");
if (EEPROM.read(12) <10)
u8g.print("0");
u8g.print (EEPROM.read(12));
}
while (
u8g.nextPage() );
}