Guest User

Untitled

a guest
Nov 21st, 2023
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Arduino 2.04 KB | Software | 0 0
  1. #include <SPI.h>
  2. #include <ILI9488_t3.h>
  3.  
  4. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  5. #define TFT_RST 8
  6. #define TFT_DC 10
  7. #define TFT_CS 9
  8. #define TFT_SCK 13
  9. #define TFT_MISO 12
  10. #define TFT_MOSI 11
  11.  
  12. ILI9488_t3 tft = ILI9488_t3(&SPI, TFT_CS, TFT_DC, TFT_RST);
  13. //ILI9488_t3 tft = ILI9488_t3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO);
  14.  
  15. DMAMEM RAFB fb1[480 * 320];
  16. #define SPI_SPEED    40000000
  17.  
  18. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  19. unsigned long previousMillis = 0;
  20. long interval = 40;
  21. int dummyX=10;
  22.  
  23. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  24. void setup() {
  25.     Serial.begin(9600);
  26.     tft.begin(SPI_SPEED);              
  27.     tft.setRotation(3);                
  28.     tft.setFrameBuffer(fb1);
  29.     tft.useFrameBuffer(true);
  30.     //tft.updateChangedAreasOnly(true);
  31.     tft.fillScreen(ILI9488_BLACK);
  32.     tft.setTextColor(ILI9488_WHITE);  tft.setTextSize(2);
  33.     tft.setCursor(20,65);  tft.print("HELLO");
  34.     tft.updateScreen();
  35.     delay(1500);
  36.     interval = 40;
  37. }
  38. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  39.  
  40. void loop() {
  41.  
  42.   unsigned long currentMillis = millis();
  43.   if(currentMillis-previousMillis >=interval){
  44.     previousMillis = currentMillis;
  45.     tft.fillScreen(ILI9488_BLACK);
  46.     tft.drawLine(dummyX,0,dummyX,320,ILI9488_RED);
  47.     dummyX+=20; dummyX%=480;
  48.   }
  49.   tft.updateScreen();
  50. }
  51.  
Tags: Teensy
Advertisement
Add Comment
Please, Sign In to add comment