Skip to content

Commit 2788dbc

Browse files
test
1 parent 081abb4 commit 2788dbc

File tree

1 file changed

+177
-177
lines changed

1 file changed

+177
-177
lines changed

FastDisplayPrototyping.ino

Lines changed: 177 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,193 +1,193 @@
11
// GFX Test
22

3-
// // Core graphics library
4-
// #include <Adafruit_GFX.h>
3+
// Core graphics library
4+
#include <Adafruit_GFX.h>
55

6-
// // Hardware-specific library & Definitions
7-
// #include <Adafruit_TFTLCD.h>
6+
// Hardware-specific library & Definitions
7+
#include <Adafruit_TFTLCD.h>
88

9-
// #define LCD_CS A3 // Chip Select goes to Analog 3
10-
// #define LCD_CD A2 // Command/Data goes to Analog 2
11-
// #define LCD_WR A1 // LCD Write goes to Analog 1
12-
// #define LCD_RD A0 // LCD Read goes to Analog 0
13-
// #define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
9+
#define LCD_CS A3 // Chip Select goes to Analog 3
10+
#define LCD_CD A2 // Command/Data goes to Analog 2
11+
#define LCD_WR A1 // LCD Write goes to Analog 1
12+
#define LCD_RD A0 // LCD Read goes to Analog 0
13+
#define LCD_RESET A4 // Can alternately just connect to Arduino's reset pin
1414

15-
// Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); // Initialize the display
15+
Adafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); // Initialize the display
1616

17-
// // Fast Display Prototyping library
18-
// #define OUTPUT_CODE_ON_SERIAL // Output graphical functions on the Serial Monitor, comment it to disable
19-
// #include "src/FastDisplayPrototyping.h"
20-
21-
// // Initialize the display prototyping library
22-
// FastSerialDisplay sDisplay(&tft, "tft");
23-
24-
// void setup()
25-
// {
26-
// Serial.begin(9600); // This line mandatory for using the display prototyping library, change the baud rate if needed
27-
28-
// tft.begin();
29-
// tft.setRotation(0);
30-
31-
// // Test 1
32-
// // sDisplay.runCommands(F("x;ro3;#6f5e;sc77,10;ts2;ttDisplay Prototyping;"));
33-
// // sDisplay.runCommands(F("dl10,10,h,w;lh70,30,235;lv70,8,23;"));
34-
// // sDisplay.runCommands(F("#ff00;dp100,10;"));
35-
// // sDisplay.runCommands(F("#0f83;ch280,60,20;#daad;cf280,60,15;"));
36-
// // sDisplay.runCommands(F("#ffe0;rh200,45,40,30;#f6cb;rf205,50,30,20;"));
37-
// // sDisplay.runCommands(F("#f81f;ri200,90,40,30,8;#f014;rj205,95,30,20,5;"));
38-
// // sDisplay.runCommands(F("#fbe0;gh250,100,300,100,277,140;#dd24;gf260,105,290,105,277,130;"));
39-
40-
// // Test 2
41-
// // sDisplay.runCommands(F("x;ro3;#3666;lv12,0,h;lv70,0,h;lv118,0,h;lv176,0,h;lv244,0,h;lv300,0,h;"));
42-
// // sDisplay.runCommands(F("#07e0;ch70,m,70;ch70,m,50;ch70,m,15;ch70,m,6;"));
43-
// // sDisplay.runCommands(F("#3666;dl25,0,142,h;#3666;dl111,0,0,h;#3666;dl70,0,70,h;"));
44-
// // sDisplay.runCommands(F("#ffff;ri2,200,10,20,3;ri15,200,10,20,3;;ri28,200,10,20,3;"));
45-
// // sDisplay.runCommands(F("ri80,200,30,20,3;ri180,200,10,20,3;"));
46-
// // sDisplay.runCommands(F("ri265,200,10,20,3;ri280,200,10,20,3;"));
47-
// // sDisplay.runCommands(F("#F7be;ch250,35,25;sc240,43;ttx1c;"));
48-
// // sDisplay.runCommands(F("#ffff;gf60,65,60,75,50,70;gf100,95,100,105,90,100;"));
49-
// // sDisplay.runCommands(F("gh30,120,40,125,30,130;gf40,180,40,190,30,185;"));
50-
51-
// // Draw commands
52-
// // tft.fillScreen(0x0);
53-
// // tft.setRotation(3);
54-
// // tft.setTextColor(0x3666);
55-
// // tft.drawFastVLine(12, 0, 320, 0x3666);
56-
// // tft.drawFastVLine(70, 0, 320, 0x3666);
57-
// // tft.drawFastVLine(118, 0, 320, 0x3666);
58-
// // tft.drawFastVLine(176, 0, 320, 0x3666);
59-
// // tft.drawFastVLine(244, 0, 320, 0x3666);
60-
// // tft.drawFastVLine(300, 0, 320, 0x3666);
61-
// // tft.drawLine(25, 0, 142, 320, 0x3666);
62-
// // tft.drawLine(111, 0, 0, 320, 0x3666);
63-
// // tft.drawLine(70, 0, 70, 320, 0x3666);
64-
// // tft.setTextColor(0x7e0);
65-
// // tft.drawCircle(70, 120, 70, 0x7e0);
66-
// // tft.drawCircle(70, 120, 50, 0x7e0);
67-
// // tft.drawCircle(70, 120, 15, 0x7e0);
68-
// // tft.drawCircle(70, 120, 6, 0x7e0);
69-
// // tft.setTextColor(0xffff);
70-
// // tft.drawRoundRect(2, 200, 10, 20, 3, 0xffff);
71-
// // tft.drawRoundRect(15, 200, 10, 20, 3, 0xffff);
72-
// // tft.drawRoundRect(28, 200, 10, 20, 3, 0xffff);
73-
// // tft.drawRoundRect(80, 200, 30, 20, 3, 0xffff);
74-
// // tft.drawRoundRect(180, 200, 10, 20, 3, 0xffff);
75-
// // tft.drawRoundRect(265, 200, 10, 20, 3, 0xffff);
76-
// // tft.drawRoundRect(280, 200, 10, 20, 3, 0xffff);
77-
// // tft.drawCircle(250, 35, 25, 0xf7be);
78-
// // tft.drawCircle(30,87,10,0xf7be);
79-
// // tft.setCursor(240, 43);
80-
// // tft.print("x1c");
81-
// // tft.fillTriangle(60, 65, 60, 75, 50, 70, 0xffff);
82-
// // tft.fillTriangle(100, 95, 100, 105, 90, 100, 0xffff);
83-
// // tft.drawTriangle(30,120,40,125,30,130,0xffff);
84-
// // tft.fillTriangle(40,180,40,190,30,185,0xffff);
85-
86-
// // Test 3
87-
// // sDisplay.runCommands(F("x;#ffff;y;ro3;#03d6;rf23,23,60,60;#07ff;rf20,20,60,60;"));
88-
// // sDisplay.runCommands(F("#ded8;cf133,53,30;#07f9;cf130,50,30;"));
89-
// // sDisplay.runCommands(F("#ded8;gf183,23,263,23,223,83;#f840;gf180,20,260,20,220,80;"));
90-
// // sDisplay.runCommands(F("sc15,90;ts2;#fb39;ttSquare;"));
91-
// // sDisplay.runCommands(F("sc100,90;ts2;#53e5;ttCircle;"));
92-
// // sDisplay.runCommands(F("#981f;lh0,m,h;"));
93-
94-
// // Draw Commands
95-
// tft.fillScreen(0x0);
96-
// tft.setTextColor(0xffff);
97-
// tft.fillScreen(0xffff);
98-
// tft.setRotation(3);
99-
// tft.setTextColor(0x3d6);
100-
// tft.fillRect(23, 23, 60, 60, 0x3d6);
101-
// tft.setTextColor(0x7ff);
102-
// tft.fillRect(20, 20, 60, 60, 0x7ff);
103-
// tft.setTextColor(0xded8);
104-
// tft.fillCircle(133, 53, 30, 0xded8);
105-
// tft.setTextColor(0x7f9);
106-
// tft.fillCircle(130, 50, 30, 0x7f9);
107-
// tft.setTextColor(0xded8);
108-
// tft.fillTriangle(183, 23, 263, 23, 223, 83, 0xded8);
109-
// tft.setTextColor(0xf840);
110-
// tft.fillTriangle(180, 20, 260, 20, 220, 80, 0xf840);
111-
// tft.setCursor(15, 90);
112-
// tft.setTextSize(2);
113-
// tft.setTextColor(0xfb39);
114-
// tft.print("Square");
115-
// tft.setCursor(100, 90);
116-
// tft.setTextSize(2);
117-
// tft.setTextColor(0x53e5);
118-
// tft.print("Circle");
119-
// tft.setTextColor(0x981f);
120-
// tft.drawFastHLine(0, 120, 320, 0x981f);
121-
// tft.setCursor(180, 90);
122-
// tft.setTextSize(2);
123-
// tft.setTextColor(0x401f);
124-
// tft.print("Triangle");
125-
// }
126-
127-
// void loop(void)
128-
// {
129-
// sDisplay.readCommandsFromSerial(); // This line mandatory for using the display prototyping library
130-
// // Your specific code here
131-
// }
132-
133-
// TFT eSPI test
134-
135-
#include <TFT_eSPI.h>
136-
#define OUTPUT_CODE_ON_SERIAL
17+
// Fast Display Prototyping library
18+
#define OUTPUT_CODE_ON_SERIAL // Output graphical functions on the Serial Monitor, comment it to disable
13719
#include "src/FastDisplayPrototyping.h"
13820

139-
TFT_eSPI display = TFT_eSPI();
140-
FastSerialDisplay sDisplay(&display,"display");
141-
142-
//------------------------------------------------------------------------------------------
21+
// Initialize the display prototyping library
22+
FastSerialDisplay sDisplay(&tft, "tft");
14323

14424
void setup()
14525
{
146-
Serial.begin(115200);
147-
148-
display.begin();
149-
display.setRotation(0);
150-
151-
// display.setFreeFont(LABEL2_FONT);
152-
153-
// Buffer Limit from the Serial Monitor is 64 bytes
154-
// sDisplay.runCommands(F("x;ts1;sc10,10;#17e0;thDisplay Prototyping;"));
155-
// sDisplay.runCommands(F("sc10,30;ts1;thLibrary v1.0;lh0,22,w"));
156-
// sDisplay.runCommands(F("sc10,10;tvVertical Center;sc10,85;ttNormal text;"));
157-
// sDisplay.runCommands(F("#f804;ch20,60,10;#ffe0;cf50,60,10;"));
158-
// sDisplay.runCommands(F("#05ff;gh70,50,90,60,70,70;#ffff;gf100,50,120,60,100,70;"));
159-
// sDisplay.runCommands(F("#fc7c;rh130,50,20,20;#263c;rf160,50,20,20;#efe0;ri10,100,40,40,10;"));
160-
// sDisplay.runCommands(F("#f9e0;rj60,100,40,40,13;#1f9d;lv2,45,280;#07ff;lh2,170,240;"));
161-
// sDisplay.runCommands(F("#ded8;dl2,170,240,320;"));
162-
163-
sDisplay.runCommands(F("x;#00ff;"));
164-
sDisplay.runCommands(F("sc1,1;ttHello;"));
165-
sDisplay.runCommands(F("ts2;ttWorld!;"));
166-
sDisplay.runCommands(F("#ff00;dp100,10;"));
167-
sDisplay.runCommands(F("dl2,20,2,h;"));
168-
sDisplay.runCommands(F("#005f;ch100,10,10;"));
169-
sDisplay.runCommands(F("#f104;cf120,10,10;"));
170-
sDisplay.runCommands(F("#f7c2;ce110,75,10,50;"));
171-
sDisplay.runCommands(F("#12df;cg90,75,10,50;"));
172-
sDisplay.runCommands(F("ca31,100,20,25,0,90,f8a2,00,0;"));
173-
sDisplay.runCommands(F("#f8b9;rh5,20,20,30;"));
174-
sDisplay.runCommands(F("#17de;rf5,60,20,30;"));
175-
sDisplay.runCommands(F("#17cb;ri30,20,20,30,4;"));
176-
sDisplay.runCommands(F("#18bf;rj30,60,20,30,4;"));
177-
sDisplay.runCommands(F("#17d4;gh15,120,5,110,25,110;"));
178-
sDisplay.runCommands(F("#fe42;gf35,120,25,110,55,120;"));
179-
sDisplay.runCommands(F("cb50,25,80,70,300,360,00f5,00,1;"));
180-
sDisplay.runCommands(F("ci65,35,13,77e0,0;"));
181-
sDisplay.runCommands(F("cj65,75,13,07e5,0;"));
182-
sDisplay.runCommands(F("rs70,60,5,8,20,30,f820,0;"));
183-
sDisplay.runCommands(F("rt80,100,20,20,5,fde0,0;"));
184-
185-
// display.fillScreen(TFT_BLACK);
186-
// display.fillRectHGradient(10,50,50,50,0x72ff,0xd2ff);
26+
Serial.begin(9600); // This line mandatory for using the display prototyping library, change the baud rate if needed
27+
28+
tft.begin();
29+
tft.setRotation(0);
30+
31+
// Test 1
32+
// sDisplay.runCommands(F("x;ro3;#6f5e;sc77,10;ts2;ttDisplay Prototyping;"));
33+
// sDisplay.runCommands(F("dl10,10,h,w;lh70,30,235;lv70,8,23;"));
34+
// sDisplay.runCommands(F("#ff00;dp100,10;"));
35+
// sDisplay.runCommands(F("#0f83;ch280,60,20;#daad;cf280,60,15;"));
36+
// sDisplay.runCommands(F("#ffe0;rh200,45,40,30;#f6cb;rf205,50,30,20;"));
37+
// sDisplay.runCommands(F("#f81f;ri200,90,40,30,8;#f014;rj205,95,30,20,5;"));
38+
// sDisplay.runCommands(F("#fbe0;gh250,100,300,100,277,140;#dd24;gf260,105,290,105,277,130;"));
39+
40+
// Test 2
41+
// sDisplay.runCommands(F("x;ro3;#3666;lv12,0,h;lv70,0,h;lv118,0,h;lv176,0,h;lv244,0,h;lv300,0,h;"));
42+
// sDisplay.runCommands(F("#07e0;ch70,m,70;ch70,m,50;ch70,m,15;ch70,m,6;"));
43+
// sDisplay.runCommands(F("#3666;dl25,0,142,h;#3666;dl111,0,0,h;#3666;dl70,0,70,h;"));
44+
// sDisplay.runCommands(F("#ffff;ri2,200,10,20,3;ri15,200,10,20,3;;ri28,200,10,20,3;"));
45+
// sDisplay.runCommands(F("ri80,200,30,20,3;ri180,200,10,20,3;"));
46+
// sDisplay.runCommands(F("ri265,200,10,20,3;ri280,200,10,20,3;"));
47+
// sDisplay.runCommands(F("#F7be;ch250,35,25;sc240,43;ttx1c;"));
48+
// sDisplay.runCommands(F("#ffff;gf60,65,60,75,50,70;gf100,95,100,105,90,100;"));
49+
// sDisplay.runCommands(F("gh30,120,40,125,30,130;gf40,180,40,190,30,185;"));
50+
51+
// Draw commands
52+
// tft.fillScreen(0x0);
53+
// tft.setRotation(3);
54+
// tft.setTextColor(0x3666);
55+
// tft.drawFastVLine(12, 0, 320, 0x3666);
56+
// tft.drawFastVLine(70, 0, 320, 0x3666);
57+
// tft.drawFastVLine(118, 0, 320, 0x3666);
58+
// tft.drawFastVLine(176, 0, 320, 0x3666);
59+
// tft.drawFastVLine(244, 0, 320, 0x3666);
60+
// tft.drawFastVLine(300, 0, 320, 0x3666);
61+
// tft.drawLine(25, 0, 142, 320, 0x3666);
62+
// tft.drawLine(111, 0, 0, 320, 0x3666);
63+
// tft.drawLine(70, 0, 70, 320, 0x3666);
64+
// tft.setTextColor(0x7e0);
65+
// tft.drawCircle(70, 120, 70, 0x7e0);
66+
// tft.drawCircle(70, 120, 50, 0x7e0);
67+
// tft.drawCircle(70, 120, 15, 0x7e0);
68+
// tft.drawCircle(70, 120, 6, 0x7e0);
69+
// tft.setTextColor(0xffff);
70+
// tft.drawRoundRect(2, 200, 10, 20, 3, 0xffff);
71+
// tft.drawRoundRect(15, 200, 10, 20, 3, 0xffff);
72+
// tft.drawRoundRect(28, 200, 10, 20, 3, 0xffff);
73+
// tft.drawRoundRect(80, 200, 30, 20, 3, 0xffff);
74+
// tft.drawRoundRect(180, 200, 10, 20, 3, 0xffff);
75+
// tft.drawRoundRect(265, 200, 10, 20, 3, 0xffff);
76+
// tft.drawRoundRect(280, 200, 10, 20, 3, 0xffff);
77+
// tft.drawCircle(250, 35, 25, 0xf7be);
78+
// tft.drawCircle(30,87,10,0xf7be);
79+
// tft.setCursor(240, 43);
80+
// tft.print("x1c");
81+
// tft.fillTriangle(60, 65, 60, 75, 50, 70, 0xffff);
82+
// tft.fillTriangle(100, 95, 100, 105, 90, 100, 0xffff);
83+
// tft.drawTriangle(30,120,40,125,30,130,0xffff);
84+
// tft.fillTriangle(40,180,40,190,30,185,0xffff);
85+
86+
// Test 3
87+
// sDisplay.runCommands(F("x;#ffff;y;ro3;#03d6;rf23,23,60,60;#07ff;rf20,20,60,60;"));
88+
// sDisplay.runCommands(F("#ded8;cf133,53,30;#07f9;cf130,50,30;"));
89+
// sDisplay.runCommands(F("#ded8;gf183,23,263,23,223,83;#f840;gf180,20,260,20,220,80;"));
90+
// sDisplay.runCommands(F("sc15,90;ts2;#fb39;ttSquare;"));
91+
// sDisplay.runCommands(F("sc100,90;ts2;#53e5;ttCircle;"));
92+
// sDisplay.runCommands(F("#981f;lh0,m,h;"));
93+
94+
// Draw Commands
95+
// tft.fillScreen(0x0);
96+
// tft.setTextColor(0xffff);
97+
// tft.fillScreen(0xffff);
98+
// tft.setRotation(3);
99+
// tft.setTextColor(0x3d6);
100+
// tft.fillRect(23, 23, 60, 60, 0x3d6);
101+
// tft.setTextColor(0x7ff);
102+
// tft.fillRect(20, 20, 60, 60, 0x7ff);
103+
// tft.setTextColor(0xded8);
104+
// tft.fillCircle(133, 53, 30, 0xded8);
105+
// tft.setTextColor(0x7f9);
106+
// tft.fillCircle(130, 50, 30, 0x7f9);
107+
// tft.setTextColor(0xded8);
108+
// tft.fillTriangle(183, 23, 263, 23, 223, 83, 0xded8);
109+
// tft.setTextColor(0xf840);
110+
// tft.fillTriangle(180, 20, 260, 20, 220, 80, 0xf840);
111+
// tft.setCursor(15, 90);
112+
// tft.setTextSize(2);
113+
// tft.setTextColor(0xfb39);
114+
// tft.print("Square");
115+
// tft.setCursor(100, 90);
116+
// tft.setTextSize(2);
117+
// tft.setTextColor(0x53e5);
118+
// tft.print("Circle");
119+
// tft.setTextColor(0x981f);
120+
// tft.drawFastHLine(0, 120, 320, 0x981f);
121+
// tft.setCursor(180, 90);
122+
// tft.setTextSize(2);
123+
// tft.setTextColor(0x401f);
124+
// tft.print("Triangle");
187125
}
188126

189127
void loop(void)
190128
{
129+
sDisplay.readCommandsFromSerial(); // This line mandatory for using the display prototyping library
130+
// Your specific code here
131+
}
132+
133+
// // TFT eSPI test
134+
135+
// #include <TFT_eSPI.h>
136+
// #define OUTPUT_CODE_ON_SERIAL
137+
// #include "src/FastDisplayPrototyping.h"
138+
139+
// TFT_eSPI display = TFT_eSPI();
140+
// FastSerialDisplay sDisplay(&display,"display");
141+
142+
// //------------------------------------------------------------------------------------------
143+
144+
// void setup()
145+
// {
146+
// Serial.begin(115200);
147+
148+
// display.begin();
149+
// display.setRotation(0);
150+
151+
// // display.setFreeFont(LABEL2_FONT);
152+
153+
// // Buffer Limit from the Serial Monitor is 64 bytes
154+
// // sDisplay.runCommands(F("x;ts1;sc10,10;#17e0;thDisplay Prototyping;"));
155+
// // sDisplay.runCommands(F("sc10,30;ts1;thLibrary v1.0;lh0,22,w"));
156+
// // sDisplay.runCommands(F("sc10,10;tvVertical Center;sc10,85;ttNormal text;"));
157+
// // sDisplay.runCommands(F("#f804;ch20,60,10;#ffe0;cf50,60,10;"));
158+
// // sDisplay.runCommands(F("#05ff;gh70,50,90,60,70,70;#ffff;gf100,50,120,60,100,70;"));
159+
// // sDisplay.runCommands(F("#fc7c;rh130,50,20,20;#263c;rf160,50,20,20;#efe0;ri10,100,40,40,10;"));
160+
// // sDisplay.runCommands(F("#f9e0;rj60,100,40,40,13;#1f9d;lv2,45,280;#07ff;lh2,170,240;"));
161+
// // sDisplay.runCommands(F("#ded8;dl2,170,240,320;"));
162+
163+
// sDisplay.runCommands(F("x;#00ff;"));
164+
// sDisplay.runCommands(F("sc1,1;ttHello;"));
165+
// sDisplay.runCommands(F("ts2;ttWorld!;"));
166+
// sDisplay.runCommands(F("#ff00;dp100,10;"));
167+
// sDisplay.runCommands(F("dl2,20,2,h;"));
168+
// sDisplay.runCommands(F("#005f;ch100,10,10;"));
169+
// sDisplay.runCommands(F("#f104;cf120,10,10;"));
170+
// sDisplay.runCommands(F("#f7c2;ce110,75,10,50;"));
171+
// sDisplay.runCommands(F("#12df;cg90,75,10,50;"));
172+
// sDisplay.runCommands(F("ca31,100,20,25,0,90,f8a2,00,0;"));
173+
// sDisplay.runCommands(F("#f8b9;rh5,20,20,30;"));
174+
// sDisplay.runCommands(F("#17de;rf5,60,20,30;"));
175+
// sDisplay.runCommands(F("#17cb;ri30,20,20,30,4;"));
176+
// sDisplay.runCommands(F("#18bf;rj30,60,20,30,4;"));
177+
// sDisplay.runCommands(F("#17d4;gh15,120,5,110,25,110;"));
178+
// sDisplay.runCommands(F("#fe42;gf35,120,25,110,55,120;"));
179+
// sDisplay.runCommands(F("cb50,25,80,70,300,360,00f5,00,1;"));
180+
// sDisplay.runCommands(F("ci65,35,13,77e0,0;"));
181+
// sDisplay.runCommands(F("cj65,75,13,07e5,0;"));
182+
// sDisplay.runCommands(F("rs70,60,5,8,20,30,f820,0;"));
183+
// sDisplay.runCommands(F("rt80,100,20,20,5,fde0,0;"));
184+
185+
// // display.fillScreen(TFT_BLACK);
186+
// // display.fillRectHGradient(10,50,50,50,0x72ff,0xd2ff);
187+
// }
188+
189+
// void loop(void)
190+
// {
191191

192-
sDisplay.readCommandsFromSerial();
193-
}
192+
// sDisplay.readCommandsFromSerial();
193+
// }

0 commit comments

Comments
 (0)