首页
NodeMcu
NodeMcu_ESP8266开发板--TCP Server
NodeMcu_ESP8266简介
NodeMcu_温湿度传感器(DHT11)的使用
esp8266+DHT11温湿传感器 制作web室内温度计
ESP8266NodeMcu网页控制四个LED灯
NodeMcu用网页上传图片来驱动1.44寸TFT屏幕
esp8266使用1.44寸tft屏Arduino模块示例程序
1.44寸TFT屏ST7735使用方法
NodeMcu_ESP8266编程
NodeMcu环境监控+远程控制
NodeMcu实现网页远程控制+温湿度显示
NodeMcu网页控制+温湿度显示+TFT
NodeMcu、ESP8266、ESP32区别
本文档由 内网文摘 发布,转载请注明出处
-
+
首页
esp8266使用1.44寸tft屏Arduino模块示例程序
1.44寸Arduino黑色模块示例程序 转发:http://www.lcdwiki.com/zh/1.44inch_SPI_Arduino_Module_Black_SKU:MAR1442 资源链接:http://www.lcdwiki.com/res/MAR1441/Arduino_Black_Module_ESP8266_Demo.zip LCDWIKI 1.44inch Arduino Black 模块测试程序说明 ### 测试平台介绍 开发板:ESP8266MOD开发板 MCU :ESP8266 晶振 :80MHZ 使用硬件SPI功能 ![](/media/202110//1635403668.8970447.png) NC 不需要接线 GND -\- G VCC -\- 3V D4引脚默认是拉高的,所以接上LED引脚后,不需要再进行拉高处理。 ### 例程功能说明 - 本套测试程序程序适用于ESP8266平台; - 本套测试程序使用单片机平台的硬件SPI功能,所以SDI和CLK接线引脚不能更改; - 请按照上述接线说明进行接线; - 本套测试程序使用Arduino IDE 1.8.5,请使用相同或以上版本; 本套测试程序包含3个测试示例: 1. clear\_Screen显示简单刷屏,此测试示例不需要依赖库,可以直接编译下载并运行,可以用来检测接线是否正确,LCD显示是否正常; 2. graphicstest显示图形和文字,需要依赖Adafruit\_ST7735和Adafruit\_GFX库; 3. rotationtest显示图形和文字旋转,需要依赖Adafruit\_ST7735和Adafruit\_GFX库; #### clear\_Screen示例 效果:整个屏幕单一颜色,红、黄、蓝色等,1秒间隔时间切换 源码 ```cpp #include <SPI.h> #define X_MAX_PIXEL 128 #define Y_MAX_PIXEL 128 #define LCD_CS D1 #define LCD_RST D2 #define LCD_RS D3 #define LCD_CS_SET (digitalWrite(LCD_CS,HIGH)) #define LCD_RST_SET (digitalWrite(LCD_RST,HIGH)) #define LCD_RS_SET (digitalWrite(LCD_RS,HIGH)) #define LCD_CS_CLR (digitalWrite(LCD_CS,LOW)) #define LCD_RST_CLR (digitalWrite(LCD_RST,LOW)) #define LCD_RS_CLR (digitalWrite(LCD_RS,LOW)) #define BLACK 0x0000 #define WHITE 0xFFFF #define RED 0xF800 #define GREEN 0x07E0 #define BLUE 0x001F void spi_init(void) { SPI.begin(); SPI.setClockDivider(SPI_CLOCK_DIV4); // 4 MHz (half speed) SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE0); } void spi_write(unsigned char data) { SPI.transfer(data); } void Lcd_WriteIndex(unsigned char index) { LCD_CS_CLR; LCD_RS_CLR; spi_write(index); LCD_CS_SET; } void Lcd_WriteData(unsigned char data) { LCD_CS_CLR; LCD_RS_SET; spi_write(data); LCD_CS_SET; } void Lcd_SetRegion(unsigned int x_start,unsigned int y_start,unsigned int x_end,unsigned int y_end) { Lcd_WriteIndex(0x2a); Lcd_WriteData(0x00); Lcd_WriteData(x_start+2); Lcd_WriteData(0x00); Lcd_WriteData(x_end+2); Lcd_WriteIndex(0x2b); Lcd_WriteData(0x00); Lcd_WriteData(y_start+3); Lcd_WriteData(0x00); Lcd_WriteData(y_end+3); Lcd_WriteIndex(0x2c); } void Lcd_Reset(void) { LCD_RST_CLR; delay(100); LCD_RST_SET; delay(50); } void Lcd_WriteReg(unsigned char index,unsigned char data) { Lcd_WriteIndex(index); Lcd_WriteData(data); } void LCD_WriteData_16Bit(unsigned int data) { LCD_CS_CLR; LCD_RS_SET; spi_write(data>>8); spi_write(data); LCD_CS_SET; } void Lcd_Clear(unsigned int color) { unsigned int i,m; Lcd_SetRegion(0,0,X_MAX_PIXEL-1,Y_MAX_PIXEL-1); Lcd_WriteIndex(0x2C); for(i=0;i<X_MAX_PIXEL;i++) for(m=0;m<Y_MAX_PIXEL;m++) { LCD_WriteData_16Bit(color); } } void Lcd_Init(void) { Lcd_Reset(); //Reset before LCD Init. //LCD Init For 1.44Inch LCD Panel with ST7735R. Lcd_WriteIndex(0x11);//Sleep exit delay(120); //ST7735R Frame Rate Lcd_WriteIndex(0xB1); Lcd_WriteData(0x01); Lcd_WriteData(0x2C); Lcd_WriteData(0x2D); Lcd_WriteIndex(0xB2); Lcd_WriteData(0x01); Lcd_WriteData(0x2C); Lcd_WriteData(0x2D); Lcd_WriteIndex(0xB3); Lcd_WriteData(0x01); Lcd_WriteData(0x2C); Lcd_WriteData(0x2D); Lcd_WriteData(0x01); Lcd_WriteData(0x2C); Lcd_WriteData(0x2D); Lcd_WriteIndex(0xB4); //Column inversion Lcd_WriteData(0x07); //ST7735R Power Sequence Lcd_WriteIndex(0xC0); Lcd_WriteData(0xA2); Lcd_WriteData(0x02); Lcd_WriteData(0x84); Lcd_WriteIndex(0xC1); Lcd_WriteData(0xC5); Lcd_WriteIndex(0xC2); Lcd_WriteData(0x0A); Lcd_WriteData(0x00); Lcd_WriteIndex(0xC3); Lcd_WriteData(0x8A); Lcd_WriteData(0x2A); Lcd_WriteIndex(0xC4); Lcd_WriteData(0x8A); Lcd_WriteData(0xEE); Lcd_WriteIndex(0xC5); //VCOM Lcd_WriteData(0x0E); Lcd_WriteIndex(0x36); //MX, MY, RGB mode Lcd_WriteData(0xC8); //ST7735R Gamma Sequence Lcd_WriteIndex(0xe0); Lcd_WriteData(0x0f); Lcd_WriteData(0x1a); Lcd_WriteData(0x0f); Lcd_WriteData(0x18); Lcd_WriteData(0x2f); Lcd_WriteData(0x28); Lcd_WriteData(0x20); Lcd_WriteData(0x22); Lcd_WriteData(0x1f); Lcd_WriteData(0x1b); Lcd_WriteData(0x23); Lcd_WriteData(0x37); Lcd_WriteData(0x00); Lcd_WriteData(0x07); Lcd_WriteData(0x02); Lcd_WriteData(0x10); Lcd_WriteIndex(0xe1); Lcd_WriteData(0x0f); Lcd_WriteData(0x1b); Lcd_WriteData(0x0f); Lcd_WriteData(0x17); Lcd_WriteData(0x33); Lcd_WriteData(0x2c); Lcd_WriteData(0x29); Lcd_WriteData(0x2e); Lcd_WriteData(0x30); Lcd_WriteData(0x30); Lcd_WriteData(0x39); Lcd_WriteData(0x3f); Lcd_WriteData(0x00); Lcd_WriteData(0x07); Lcd_WriteData(0x03); Lcd_WriteData(0x10); Lcd_WriteIndex(0x2a); Lcd_WriteData(0x00); Lcd_WriteData(0x00); Lcd_WriteData(0x00); Lcd_WriteData(0x7f); Lcd_WriteIndex(0x2b); Lcd_WriteData(0x00); Lcd_WriteData(0x00); Lcd_WriteData(0x00); Lcd_WriteData(0x9f); Lcd_WriteIndex(0xF0); //Enable test command Lcd_WriteData(0x01); Lcd_WriteIndex(0xF6); //Disable ram power save mode Lcd_WriteData(0x00); Lcd_WriteIndex(0x3A); //65k mode Lcd_WriteData(0x05); Lcd_WriteIndex(0x29);//Display on } void pin_init(void) { pinMode(LCD_CS, OUTPUT); pinMode(LCD_RST, OUTPUT); pinMode(LCD_RS, OUTPUT); LCD_CS_SET; LCD_RST_SET; LCD_RS_SET; } void setup() { Serial.begin(9600); spi_init(); pin_init(); Lcd_Init(); Lcd_Clear(BLACK); } void loop() { Lcd_Clear(WHITE); delay(1000); Lcd_Clear(BLACK); delay(1000); Lcd_Clear(RED); delay(1000); Lcd_Clear(GREEN); delay(1000); Lcd_Clear(BLUE); delay(1000); } ``` #### graphicstest示例 效果: ![](/media/202110/2021-10-28_154326.png) 源码 ```cpp /*************************************************** This is a library for the Adafruit 1.8" SPI display. This library works with the Adafruit 1.8" TFT Breakout w/SD card ----> http://www.adafruit.com/products/358 The 1.8" TFT shield ----> https://www.adafruit.com/product/802 The 1.44" TFT breakout ----> https://www.adafruit.com/product/2088 as well as Adafruit raw 1.8" TFT display ----> http://www.adafruit.com/products/618 Check out the links above for our tutorials and wiring diagrams These displays use SPI to communicate, 4 or 5 pins are required to interface (RST is optional) Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. MIT license, all text above must be included in any redistribution ****************************************************/ #include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_ST7735.h> // Hardware-specific library #include <SPI.h> // For the breakout, you can use any 2 or 3 pins // These pins will also work for the 1.8" TFT shield #define TFT_CS D1 #define TFT_RST D2 // you can also connect this to the Arduino reset // in which case, set this #define pin to 0! #define TFT_DC D3 // Option 1 (recommended): must use the hardware SPI pins // (for UNO thats sclk = 13 and sid = 11) and pin 10 must be // an output. This is much faster - also required if you want // to use the microSD card (see the image drawing example) Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); // Option 2: use any pins but a little slower! #define TFT_SCLK 13 // set these to be whatever pins you like! #define TFT_MOSI 11 // set these to be whatever pins you like! //Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); float p = 3.1415926; void setup(void) { Serial.begin(9600); Serial.print("Hello! ST7735 TFT Test"); // Use this initializer if you're using a 1.8" TFT // tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab // Use this initializer (uncomment) if you're using a 1.44" TFT tft.initR(INITR_144GREENTAB); // initialize a ST7735S chip, black tab Serial.println("Initialized"); uint16_t time = millis(); tft.fillScreen(ST7735_BLACK); time = millis() - time; Serial.println(time, DEC); delay(500); // large block of text tft.fillScreen(ST7735_BLACK); testdrawtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur adipiscing ante sed nibh tincidunt feugiat. Maecenas enim massa, fringilla sed malesuada et, malesuada sit amet turpis. Sed porttitor neque ut ante pretium vitae malesuada nunc bibendum. Nullam aliquet ultrices massa eu hendrerit. Ut sed nisi lorem. In vestibulum purus a tortor imperdiet posuere. ", ST7735_WHITE); delay(1000); // tft print function! tftPrintTest(); delay(4000); // a single pixel tft.drawPixel(tft.width()/2, tft.height()/2, ST7735_GREEN); delay(500); // line draw test testlines(ST7735_YELLOW); delay(500); // optimized lines testfastlines(ST7735_RED, ST7735_BLUE); delay(500); testdrawrects(ST7735_GREEN); delay(500); testfillrects(ST7735_YELLOW, ST7735_MAGENTA); delay(500); tft.fillScreen(ST7735_BLACK); testfillcircles(10, ST7735_BLUE); testdrawcircles(10, ST7735_WHITE); delay(500); testroundrects(); delay(500); testtriangles(); delay(500); mediabuttons(); delay(500); Serial.println("done"); delay(1000); } void loop() { tft.invertDisplay(true); delay(500); tft.invertDisplay(false); delay(500); } void testlines(uint16_t color) { tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(0, 0, x, tft.height()-1, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(0, 0, tft.width()-1, y, color); } tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(tft.width()-1, 0, 0, y, color); } tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(0, tft.height()-1, x, 0, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(0, tft.height()-1, tft.width()-1, y, color); } tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color); } } void testdrawtext(char *text, uint16_t color) { tft.setCursor(0, 0); tft.setTextColor(color); tft.setTextWrap(true); tft.print(text); } void testfastlines(uint16_t color1, uint16_t color2) { tft.fillScreen(ST7735_BLACK); for (int16_t y=0; y < tft.height(); y+=5) { tft.drawFastHLine(0, y, tft.width(), color1); } for (int16_t x=0; x < tft.width(); x+=5) { tft.drawFastVLine(x, 0, tft.height(), color2); } } void testdrawrects(uint16_t color) { tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color); } } void testfillrects(uint16_t color1, uint16_t color2) { tft.fillScreen(ST7735_BLACK); for (int16_t x=tft.width()-1; x > 6; x-=6) { tft.fillRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color1); tft.drawRect(tft.width()/2 -x/2, tft.height()/2 -x/2 , x, x, color2); } } void testfillcircles(uint8_t radius, uint16_t color) { for (int16_t x=radius; x < tft.width(); x+=radius*2) { for (int16_t y=radius; y < tft.height(); y+=radius*2) { tft.fillCircle(x, y, radius, color); } } } void testdrawcircles(uint8_t radius, uint16_t color) { for (int16_t x=0; x < tft.width()+radius; x+=radius*2) { for (int16_t y=0; y < tft.height()+radius; y+=radius*2) { tft.drawCircle(x, y, radius, color); } } } void testtriangles() { tft.fillScreen(ST7735_BLACK); int color = 0xF800; int t; int w = tft.width()/2; int x = tft.height()-1; int y = 0; int z = tft.width(); for(t = 0 ; t <= 15; t+=1) { tft.drawTriangle(w, y, y, x, z, x, color); x-=4; y+=4; z-=4; color+=100; } } void testroundrects() { tft.fillScreen(ST7735_BLACK); int color = 100; int i; int t; for(t = 0 ; t <= 4; t+=1) { int x = 0; int y = 0; int w = tft.width()-2; int h = tft.height()-2; for(i = 0 ; i <= 16; i+=1) { tft.drawRoundRect(x, y, w, h, 5, color); x+=2; y+=3; w-=4; h-=6; color+=1100; } color+=100; } } void tftPrintTest() { tft.setTextWrap(false); tft.fillScreen(ST7735_BLACK); tft.setCursor(0, 30); tft.setTextColor(ST7735_RED); tft.setTextSize(1); tft.println("Hello World!"); tft.setTextColor(ST7735_YELLOW); tft.setTextSize(2); tft.println("Hello World!"); tft.setTextColor(ST7735_GREEN); tft.setTextSize(3); tft.println("Hello World!"); tft.setTextColor(ST7735_BLUE); tft.setTextSize(4); tft.print(1234.567); delay(1500); tft.setCursor(0, 0); tft.fillScreen(ST7735_BLACK); tft.setTextColor(ST7735_WHITE); tft.setTextSize(0); tft.println("Hello World!"); tft.setTextSize(1); tft.setTextColor(ST7735_GREEN); tft.print(p, 6); tft.println(" Want pi?"); tft.println(" "); tft.print(8675309, HEX); // print 8,675,309 out in HEX! tft.println(" Print HEX!"); tft.println(" "); tft.setTextColor(ST7735_WHITE); tft.println("Sketch has been"); tft.println("running for: "); tft.setTextColor(ST7735_MAGENTA); tft.print(millis() / 1000); tft.setTextColor(ST7735_WHITE); tft.print(" seconds."); } void mediabuttons() { // play tft.fillScreen(ST7735_BLACK); tft.fillRoundRect(25, 10, 78, 50, 8, ST7735_WHITE); tft.fillTriangle(42, 20, 42, 50, 90, 35, ST7735_RED); delay(500); // pause tft.fillRoundRect(25, 70, 78, 50, 8, ST7735_WHITE); tft.fillRoundRect(39, 78, 20, 35, 5, ST7735_GREEN); tft.fillRoundRect(69, 78, 20, 35, 5, ST7735_GREEN); delay(500); // play color tft.fillTriangle(42, 20, 42, 50, 90, 35, ST7735_BLUE); delay(50); // pause color tft.fillRoundRect(39, 78, 20, 35, 5, ST7735_RED); tft.fillRoundRect(69, 78, 20, 35, 5, ST7735_RED); // play color tft.fillTriangle(42, 20, 42, 50, 90, 35, ST7735_GREEN); } ``` #### rotationtest示例 效果:各种方向显示的文字,图形 源码 ```cpp /*************************************************** This is a library for the Adafruit 1.8" SPI display. This library works with the Adafruit 1.8" TFT Breakout w/SD card ----> http://www.adafruit.com/products/358 The 1.8" TFT shield ----> https://www.adafruit.com/product/802 The 1.44" TFT breakout ----> https://www.adafruit.com/product/2088 as well as Adafruit raw 1.8" TFT display ----> http://www.adafruit.com/products/618 Check out the links above for our tutorials and wiring diagrams These displays use SPI to communicate, 4 or 5 pins are required to interface (RST is optional) Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. MIT license, all text above must be included in any redistribution ****************************************************/ #include <Adafruit_GFX.h> // Core graphics library #include <Adafruit_ST7735.h> // Hardware-specific library #include <SPI.h> // For the breakout, you can use any 2 or 3 pins // These pins will also work for the 1.8" TFT shield #define TFT_CS D1 #define TFT_RST D2 // you can also connect this to the Arduino reset // in which case, set this #define pin to 0! #define TFT_DC D3 // Option 1 (recommended): must use the hardware SPI pins // (for UNO thats sclk = 13 and sid = 11) and pin 10 must be // an output. This is much faster - also required if you want // to use the microSD card (see the image drawing example) Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST); // Option 2: use any pins but a little slower! #define TFT_SCLK 13 // set these to be whatever pins you like! #define TFT_MOSI 11 // set these to be whatever pins you like! //Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST); void setup(void) { Serial.begin(9600); Serial.print("Hello! Adafruit ST7735 rotation test"); // Use this initializer if you're using a 1.8" TFT //tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab // Use this initializer (uncomment) if you're using a 1.44" TFT tft.initR(INITR_144GREENTAB); // initialize a ST7735S chip, black tab Serial.println("init"); tft.setTextWrap(false); // Allow text to run off right edge tft.fillScreen(ST7735_BLACK); Serial.println("This is a test of the rotation capabilities of the TFT library!"); Serial.println("Press <SEND> (or type a character) to advance"); } void loop(void) { rotateLine(); rotateText(); rotatePixel(); rotateFastline(); rotateDrawrect(); rotateFillrect(); rotateDrawcircle(); rotateFillcircle(); rotateTriangle(); rotateFillTriangle(); rotateRoundRect(); rotateFillRoundRect(); rotateChar(); rotateString(); } void rotateText() { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.setCursor(0, 30); tft.setTextColor(ST7735_RED); tft.setTextSize(1); tft.println("Hello World!"); tft.setTextColor(ST7735_YELLOW); tft.setTextSize(2); tft.println("Hello World!"); tft.setTextColor(ST7735_GREEN); tft.setTextSize(3); tft.println("Hello World!"); tft.setTextColor(ST7735_BLUE); tft.setTextSize(4); tft.print(1234.567); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateFillcircle(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.fillCircle(10, 30, 10, ST7735_YELLOW); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateDrawcircle(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawCircle(10, 30, 10, ST7735_YELLOW); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateFillrect(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.fillRect(10, 20, 10, 20, ST7735_GREEN); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateDrawrect(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawRect(10, 20, 10, 20, ST7735_GREEN); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateFastline(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawFastHLine(0, 20, tft.width(), ST7735_RED); tft.drawFastVLine(20, 0, tft.height(), ST7735_BLUE); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateLine(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawLine(tft.width()/2, tft.height()/2, 0, 0, ST7735_RED); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotatePixel(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawPixel(10,20, ST7735_WHITE); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateTriangle(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawTriangle(20, 10, 10, 30, 30, 30, ST7735_GREEN); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateFillTriangle(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.fillTriangle(20, 10, 10, 30, 30, 30, ST7735_RED); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateRoundRect(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawRoundRect(20, 10, 25, 15, 5, ST7735_BLUE); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateFillRoundRect(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.fillRoundRect(20, 10, 25, 15, 5, ST7735_CYAN); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateChar(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.drawChar(25, 15, 'A', ST7735_WHITE, ST7735_WHITE, 1); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } void rotateString(void) { for (uint8_t i=0; i<4; i++) { tft.fillScreen(ST7735_BLACK); Serial.println(tft.getRotation(), DEC); tft.setCursor(8, 25); tft.setTextSize(1); tft.setTextColor(ST7735_WHITE); tft.print("Adafruit Industries"); // while (!Serial.available()); // Serial.read(); Serial.read(); Serial.read(); tft.setRotation(tft.getRotation()+1); delay(1000); } } ``` [【附件】Arduino_Black_Module_ESP8266驱动1.44寸tft屏_Demo.zip](/media/attachment/2021/10/Arduino_Black_Module_ESP8266驱动1.44寸tft屏_Demo.zip)
local
2021年10月28日 15:54
分享文档
收藏文档
上一篇
下一篇
微信扫一扫
复制链接
手机扫一扫进行分享
复制链接
关于 LocalNetwork
LocalNetwork
是由mrdoc开源
LocalNetwork.cn
修改的在线文档系统,作为个人和小型团队的云笔记、文档和知识库管理工具。
如果此文档给你或你的团队带来了帮助,欢迎支持作者持续投入精力更新和维护!内网文摘 & LocalNetwork
>>>主页
logo
logo
下载Markdown文件
分享
链接
类型
密码
更新密码