1
+ #include " HT_st7735.h"
2
+ #include " Arduino.h"
3
+ HT_st7735 st7735;
4
+ void setup ()
5
+ {
6
+ Serial.begin (115200 );
7
+ st7735.st7735_init ();
8
+ Serial.printf (" Ready!\r\n " );
9
+ }
10
+
11
+ void loop () {
12
+ // Check border
13
+ st7735.st7735_fill_screen (ST7735_BLACK);
14
+
15
+ for (int x = 0 ; x < ST7735_WIDTH; x++) {
16
+ st7735.st7735_draw_pixel (x, 0 , ST7735_RED);
17
+ st7735.st7735_draw_pixel (x, ST7735_HEIGHT-1 , ST7735_RED);
18
+ }
19
+
20
+ for (int y = 0 ; y < ST7735_HEIGHT; y++) {
21
+ st7735.st7735_draw_pixel (0 , y, ST7735_RED);
22
+ st7735.st7735_draw_pixel (ST7735_WIDTH-1 , y, ST7735_RED);
23
+ }
24
+
25
+ delay (3000 );
26
+
27
+ // Check fonts
28
+ st7735.st7735_fill_screen (ST7735_BLACK);
29
+ st7735.st7735_write_str (0 , 0 , " Font_7x10, red on black, lorem ipsum dolor sit amet" , Font_7x10, ST7735_RED, ST7735_BLACK);
30
+ st7735.st7735_write_str (0 , 3 *10 , " Font_11x18, green, lorem ipsum" , Font_11x18, ST7735_GREEN, ST7735_BLACK);
31
+ st7735.st7735_write_str (0 , 3 *10 +3 *18 , " Font_16x26" , Font_16x26, ST7735_BLUE, ST7735_BLACK);
32
+ delay (2000 );
33
+
34
+ // Check colors
35
+ st7735.st7735_fill_screen (ST7735_BLACK);
36
+ st7735.st7735_write_str (0 , 0 , " BLACK" , Font_11x18, ST7735_WHITE, ST7735_BLACK);
37
+ delay (500 );
38
+
39
+ st7735.st7735_fill_screen (ST7735_BLUE);
40
+ st7735.st7735_write_str (0 , 0 , " BLUE" , Font_11x18, ST7735_BLACK, ST7735_BLUE);
41
+ delay (500 );
42
+
43
+ st7735.st7735_fill_screen (ST7735_RED);
44
+ st7735.st7735_write_str (0 , 0 , " RED" , Font_11x18, ST7735_BLACK, ST7735_RED);
45
+ delay (500 );
46
+
47
+ st7735.st7735_fill_screen (ST7735_GREEN);
48
+ st7735.st7735_write_str (0 , 0 , " GREEN" , Font_11x18, ST7735_BLACK, ST7735_GREEN);
49
+ delay (500 );
50
+
51
+ st7735.st7735_fill_screen (ST7735_CYAN);
52
+ st7735.st7735_write_str (0 , 0 , " CYAN" , Font_11x18, ST7735_BLACK, ST7735_CYAN);
53
+ delay (500 );
54
+
55
+ st7735.st7735_fill_screen (ST7735_MAGENTA);
56
+ st7735.st7735_write_str (0 , 0 , " MAGENTA" , Font_11x18, ST7735_BLACK, ST7735_MAGENTA);
57
+ delay (500 );
58
+
59
+ st7735.st7735_fill_screen (ST7735_YELLOW);
60
+ st7735.st7735_write_str (0 , 0 , " YELLOW" , Font_11x18, ST7735_BLACK, ST7735_YELLOW);
61
+ delay (500 );
62
+
63
+ st7735.st7735_fill_screen (ST7735_WHITE);
64
+ st7735.st7735_write_str (0 , 0 , " WHITE" , Font_11x18, ST7735_BLACK, ST7735_WHITE);
65
+ delay (500 );
66
+ }
0 commit comments