Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: **Display Testing**
- - Source Code NOT compiled for: Arduino Uno
- - Source Code created on: 2025-02-12 03:37:44
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* make sure ST7789V display not white screen */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <Adafruit_GFX.h> //https://github.com/adafruit/Adafruit-GFX-Library
- #include <Adafruit_ST7789.h> // Added for ST7789 display support
- #include <SPI.h> // Added for SPI communication
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- #define TFT_CS 6
- #define TFT_DC 8
- #define TFT_RST 7
- Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST); // Instance of the display class
- void setup(void)
- {
- // put your setup code here, to run once:
- Serial.begin(9600);
- Serial.println("Initializing TFT display...");
- tft.init(240, 320, SPI_MODE0);
- tft.setRotation(1); // Try different values (0-3)
- Serial.println("Display initialized!");
- // Fill the screen with a color to avoid white screen issue
- tft.fillScreen(ST77XX_BLACK); // Set initial screen color to black
- delay(500);
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- tft.fillScreen(ST77XX_BLACK); // Clear screen each loop
- tft.setTextColor(ST77XX_WHITE);
- tft.setTextSize(2);
- tft.setCursor(50, 50);
- tft.println("ST7789 TEST");
- delay(1000);
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement