-
Notifications
You must be signed in to change notification settings - Fork 190
/
1-HelloWorld.ino
57 lines (44 loc) · 1.93 KB
/
1-HelloWorld.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*******************************************************************
Hello World for the ESP32 Cheap Yellow Display.
https://github.com/witnessmenow/ESP32-Cheap-Yellow-Display
If you find what I do useful and would like to support me,
please consider becoming a sponsor on Github
https://github.com/sponsors/witnessmenow/
Written by Brian Lough
YouTube: https://www.youtube.com/brianlough
Twitter: https://twitter.com/witnessmenow
*******************************************************************/
// Make sure to copy the UserSetup.h file into the library as
// per the Github Instructions. The pins are defined in there.
// Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
// Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
// Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
// Note the following larger fonts are primarily numeric only!
// Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
// Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
// Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#include <TFT_eSPI.h>
// A library for interfacing with LCD displays
//
// Can be installed from the library manager (Search for "TFT_eSPI")
//https://github.com/Bodmer/TFT_eSPI
TFT_eSPI tft = TFT_eSPI();
void setup() {
// Start the tft display and set it to black
tft.init();
tft.setRotation(1); //This is the display in landscape
// Clear the screen before writing to it
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
int x = 5;
int y = 10;
int fontNum = 2;
tft.drawString("Hello", x, y, fontNum); // Left Aligned
x = 320 /2;
y += 16;
tft.setTextColor(TFT_BLUE, TFT_BLACK);
tft.drawCentreString("World", x, y, fontNum);
}
void loop() {
// put your main code here, to run repeatedly:
}