acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
HelloWorld.ino (3121B)
1 /******************************************************************************* 2 * Start of Arduino_GFX setting 3 * 4 * Arduino_GFX try to find the settings depends on selected board in Arduino IDE 5 * Or you can define the display dev kit not in the board list 6 * Defalult pin list for non display dev kit: 7 * Arduino Nano, Micro and more: CS: 9, DC: 8, RST: 7, BL: 6, SCK: 13, MOSI: 11, MISO: 12 8 * ESP32 various dev board : CS: 5, DC: 27, RST: 33, BL: 22, SCK: 18, MOSI: 23, MISO: nil 9 * ESP32-C3 various dev board : CS: 7, DC: 2, RST: 1, BL: 3, SCK: 4, MOSI: 6, MISO: nil 10 * ESP32-S2 various dev board : CS: 34, DC: 38, RST: 33, BL: 21, SCK: 36, MOSI: 35, MISO: nil 11 * ESP32-S3 various dev board : CS: 40, DC: 41, RST: 42, BL: 48, SCK: 36, MOSI: 35, MISO: nil 12 * ESP8266 various dev board : CS: 15, DC: 4, RST: 2, BL: 5, SCK: 14, MOSI: 13, MISO: 12 13 * Raspberry Pi Pico dev board : CS: 17, DC: 27, RST: 26, BL: 28, SCK: 18, MOSI: 19, MISO: 16 14 * RTL8720 BW16 old patch core : CS: 18, DC: 17, RST: 2, BL: 23, SCK: 19, MOSI: 21, MISO: 20 15 * RTL8720_BW16 Official core : CS: 9, DC: 8, RST: 6, BL: 3, SCK: 10, MOSI: 12, MISO: 11 16 * RTL8722 dev board : CS: 18, DC: 17, RST: 22, BL: 23, SCK: 13, MOSI: 11, MISO: 12 17 * RTL8722_mini dev board : CS: 12, DC: 14, RST: 15, BL: 13, SCK: 11, MOSI: 9, MISO: 10 18 * Seeeduino XIAO dev board : CS: 3, DC: 2, RST: 1, BL: 0, SCK: 8, MOSI: 10, MISO: 9 19 * Teensy 4.1 dev board : CS: 39, DC: 41, RST: 40, BL: 22, SCK: 13, MOSI: 11, MISO: 12 20 ******************************************************************************/ 21 #include <Arduino_GFX_Library.h> 22 23 #define GFX_BL DF_GFX_BL // default backlight pin, you may replace DF_GFX_BL to actual backlight pin 24 25 /* More dev device declaration: https://github.com/moononournation/Arduino_GFX/wiki/Dev-Device-Declaration */ 26 #if defined(DISPLAY_DEV_KIT) 27 Arduino_GFX *gfx = create_default_Arduino_GFX(); 28 #else /* !defined(DISPLAY_DEV_KIT) */ 29 30 /* More data bus class: https://github.com/moononournation/Arduino_GFX/wiki/Data-Bus-Class */ 31 Arduino_DataBus *bus = create_default_Arduino_DataBus(); 32 33 /* More display class: https://github.com/moononournation/Arduino_GFX/wiki/Display-Class */ 34 Arduino_GFX *gfx = new Arduino_ILI9341(bus, DF_GFX_RST, 0 /* rotation */, false /* IPS */); 35 36 #endif /* !defined(DISPLAY_DEV_KIT) */ 37 /******************************************************************************* 38 * End of Arduino_GFX setting 39 ******************************************************************************/ 40 41 void setup(void) 42 { 43 gfx->begin(); 44 gfx->fillScreen(BLACK); 45 46 #ifdef GFX_BL 47 pinMode(GFX_BL, OUTPUT); 48 digitalWrite(GFX_BL, HIGH); 49 #endif 50 51 gfx->setCursor(10, 10); 52 gfx->setTextColor(RED); 53 gfx->println("Hello World!"); 54 55 delay(5000); // 5 seconds 56 } 57 58 void loop() 59 { 60 gfx->setCursor(random(gfx->width()), random(gfx->height())); 61 gfx->setTextColor(random(0xffff), random(0xffff)); 62 gfx->setTextSize(random(6) /* x scale */, random(6) /* y scale */, random(2) /* pixel_margin */); 63 gfx->println("Hello World!"); 64 65 delay(1000); // 1 second 66 }