#include <SPI.h>
#include "Ucglib.h"
// Define the pins for the ILI9486 TFT display
Ucglib_ILI9486_18x320x480_SWSPI ucg(/*sclk=*/ 13, /*data=*/ 11, /*cd=*/ 9, /*cs=*/ 10, /*reset=*/ 8);
void setup() {
// Initialize communication with the TFT display
ucg.begin(UCG_FONT_MODE_SOLID);
// Set rotation of the display (optional, adjust as needed)
// ucg.setRotate(90);
// Clear the screen
ucg.clearScreen();
}
void ucglib_graphics_test(void) {
// Set background gradient colors
ucg.setColor(0, 0, 40, 80);
ucg.setColor(1, 80, 0, 40);
ucg.setColor(2, 255, 0, 255);
ucg.setColor(3, 0, 255, 255);
// Draw a gradient box
ucg.drawGradientBox(0, 0, ucg.getWidth(), ucg.getHeight());
// Set text color
ucg.setColor(255, 168, 0);
// Print text on the screen
ucg.setPrintDir(0);
ucg.setPrintPos(2, 18);
ucg.print("Ucglib");
ucg.setPrintPos(2, 18 + 20);
ucg.print("GraphicsTest");
}
void loop() {
// Run the graphics test function
ucglib_graphics_test();
// Delay for 5 seconds before restarting
delay(5000);
// Clear the screen for the next iteration
ucg.clearScreen();
}