PDA

צפייה בגרסה מלאה : מסך TFT מרצד



pardicimo
30-09-2019, 22:08:13
שלום לכולם,
מבקש שוב את עזרת המומחים, כחלק מהפרוייקט שלי אני רוצה לייצר אופק מלאכותי שישלט ע"י גוייסטיק.
לשם כך רכשתי מסך TFT עיצבתי את המסך אך כאשר אני מעביר את העיצוב ללופ הסמך מרצד לי, אשמח לעזרתכם הכוונתכם לנושא. מצרפ סרטונים להמחשה
כמו כן מצב הקוד:



#include <memorysaver.h>
#include <UTFT.h>



UTFT myGLCD(CTE32HR,38,39,40,41);
extern uint8_t SmallFont[];


void setup() {
// put your setup code here, to run once:
myGLCD.InitLCD();
myGLCD.setFont(SmallFont);

}

void loop() {
// put your main code here, to run repeatedly:
myGLCD.setColor(255, 127, 0);//orange ground
myGLCD.fillRect(240, 320, 480, 0);//location on screen
myGLCD.setColor(0, 100, 255);//blue sky
myGLCD.fillRect(0, 320, 239, 0);//location on screen
{//black climbe rate bar
myGLCD.setColor(0, 0, 0);//black alt. backrownd
myGLCD.fillRect(230, 2, 250, 50);//location on screen
myGLCD.setColor(0,0,0);//black box climb rate up
myGLCD.fillRect(10, 23, 220, 25);//location on screen
myGLCD.setColor(0,0,0);//black climb rate down
myGLCD.fillRect(260, 23, 469, 25);//location on screen
}
{//green center climb
myGLCD.setColor(0,255,0);//green center climb
myGLCD.fillRect(237, 157, 243, 163);//center climb location on screen
myGLCD.setColor(0,255,0);//green left climb
myGLCD.fillRect(237, 52, 243, 142);//location on screen
myGLCD.setColor(0,255,0);//green right climb
myGLCD.fillRect(237, 178, 243, 268);//location on screen
}
{// white climb bar sky small bar
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(220, 184, 220, 133);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(160, 184, 160, 133);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(100, 184, 100, 133);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(40, 184, 40, 133);//location on screen
}
{// white climb bar sky BIG bar
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(190, 211, 190, 106);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(130, 211, 130, 106);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(70, 211, 70, 106);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(10, 211, 10, 106);//location on screen
}
{// white climb bar ground small bar
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(260, 184, 260, 133);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(320, 184, 320, 133);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(380, 184, 380, 133);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(440, 184, 440, 133);//location on screen
}
{// white climb bar ground BIG bar
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(290, 211, 290, 106);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(350, 211, 350, 106);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(410, 211, 410, 106);//location on screen
myGLCD.setColor(VGA_WHITE);//green right climb
myGLCD.fillRect(470, 211, 470, 106);//location on screen
}
}

איזי
01-10-2019, 09:55:30
הי, עדיין לא השתעשתי עם מסכים שמחוברים לארדואינו אז מהמר כאן.

נסה להוסיף שורה אחרונה ב-loop השהיה קצרה, נניח 10 מילי ותגדיל אותה עד שהיא מפריעה לקצב הריענון של המסך.
אולי אפילו להתחיל עם משהו כמו 40 מילי שזה נותן ריענון של 25 פריימים בשניה.

איזי
01-10-2019, 10:05:10
וכמה שאלות:
- מה הסיבה שאתה משתשמש ב-
memorysaver.h?
- איזה צג בדיוק בשימוש?
- לוח ארדואינו Uno או ארדואינו אחר?

pardicimo
01-10-2019, 18:26:08
תודה רבה על התגובה!
אני לא יודע למה התווסף memorysaver.h הוא לא חלק מהקוד ונמחק.

אני משתמש בארדואינו מגה
והצג 16BIT TFT 3.2'' 480X320 צד זול יחסית ונפוץ באלי אקספרס..

איזי
02-10-2019, 07:26:29
הוספת השהיה בסיום ה-loop? היתה לזה השפעה על ההתנהגות של המסך?

ראית את זה? נראה נחמד מאד ללימוד הבסיס:
https://www.instructables.com/id/Arduino-Flappy-Bird-Game-Using-35-TFT-LCD-Touch-Sc/

מזמין מסך ומתחיל עם הפרוייקט הזה.