1.开发板

合宙esp32 c3,主频160mhz。

2.显示屏

合宙0.96寸lcd,驱动为st7735。

3.代码

这是开发板的定义,如果要修改开发板则需要去示例程序PDQ graphicstest中寻找。

Arduino_DataBus *bus = new Arduino_ESP32SPI(6 /* DC */, 7 /* CS */, 2 /* SCK */, 3 /* MOSI */, GFX_NOT_DEFINED /* MISO */);

根据屏幕驱动和分辨率选择屏幕定义,修改的话同样要去PDQ graphicstest寻找。

Arduino_GFX *gfx = new Arduino_ST7735(bus, 10 /*RST*/, 0 /* rotation */, false /* IPS */, 80 /* width */, 160 /* height */, 24 /* col offset 1 */, 0 /* row offset 1 */, 24 /* col offset 2 */, 0 /* row offset 2 */);
#define SPI_FREQUENCY  40000000#include <Arduino_GFX_Library.h>Arduino_DataBus *bus = new Arduino_ESP32SPI(6 /* DC */, 7 /* CS */, 2 /* SCK */, 3 /* MOSI */, GFX_NOT_DEFINED /* MISO */);
Arduino_GFX *gfx = new Arduino_ST7735(bus, 10 /*RST*/, 0 /* rotation */, false /* IPS */, 80 /* width */, 160 /* height */, 24 /* col offset 1 */, 0 /* row offset 1 */, 24 /* col offset 2 */, 0 /* row offset 2 */);
int32_t w, h, n, n1, cx, cy, cx1, cy1, cn, cn1;
uint8_t tsa, tsb, tsc, ds;void setup()
{Serial.begin(115200);// Serial.setDebugOutput(true);// while(!Serial);Serial.println("Arduino_GFX library Test!");#ifdef GFX_PWDpinMode(GFX_PWD, OUTPUT);digitalWrite(GFX_PWD, HIGH);
#endifgfx->begin();// gfx->begin(80000000); /* specify data bus speed */w = gfx->width();h = gfx->height();n = min(w, h);n1 = n - 1;cx = w / 2;cy = h / 2;cx1 = cx - 1;cy1 = cy - 1;cn = min(cx1, cy1);cn1 = cn - 1;tsa = ((w <= 176) || (h <= 160)) ? 1 : (((w <= 240) || (h <= 240)) ? 2 : 3); // text size Atsb = ((w <= 272) || (h <= 220)) ? 1 : 2;                                    // text size Btsc = ((w <= 220) || (h <= 220)) ? 1 : 2;                                    // text size Cds = (w <= 160) ? 9 : 12;                                                    // digit size#ifdef GFX_BLpinMode(GFX_BL, OUTPUT);digitalWrite(GFX_BL, HIGH);
#endif
}static inline uint32_t micros_start() __attribute__((always_inline));
static inline uint32_t micros_start()
{uint8_t oms = millis();while ((uint8_t)millis() == oms);return micros();
}void loop(void)
{Serial.println(F("Benchmark\tmicro-secs"));int32_t usecFillScreen = testFillScreen();serialOut(F("Screen fill\t"), usecFillScreen, 100, true);int32_t usecText = testText();serialOut(F("Text\t"), usecText, 3000, true);int32_t usecPixels = testPixels();serialOut(F("Pixels\t"), usecPixels, 100, true);int32_t usecLines = testLines();serialOut(F("Lines\t"), usecLines, 100, true);int32_t usecFastLines = testFastLines();serialOut(F("Horiz/Vert Lines\t"), usecFastLines, 100, true);int32_t usecFilledRects = testFilledRects();serialOut(F("Rectangles (filled)\t"), usecFilledRects, 100, false);int32_t usecRects = testRects();serialOut(F("Rectangles (outline)\t"), usecRects, 100, true);int32_t usecFilledTrangles = testFilledTriangles();serialOut(F("Triangles (filled)\t"), usecFilledTrangles, 100, false);int32_t usecTriangles = testTriangles();serialOut(F("Triangles (outline)\t"), usecTriangles, 100, true);int32_t usecFilledCircles = testFilledCircles(10);serialOut(F("Circles (filled)\t"), usecFilledCircles, 100, false);int32_t usecCircles = testCircles(10);serialOut(F("Circles (outline)\t"), usecCircles, 100, true);int32_t usecFilledArcs = testFillArcs();serialOut(F("Arcs (filled)\t"), usecFilledArcs, 100, false);int32_t usecArcs = testArcs();serialOut(F("Arcs (outline)\t"), usecArcs, 100, true);int32_t usecFilledRoundRects = testFilledRoundRects();serialOut(F("Rounded rects (filled)\t"), usecFilledRoundRects, 100, false);int32_t usecRoundRects = testRoundRects();serialOut(F("Rounded rects (outline)\t"), usecRoundRects, 100, true);#ifdef CANVASuint32_t start = micros_start();gfx->flush();int32_t usecFlush = micros() - start;serialOut(F("flush (Canvas only)\t"), usecFlush, 0, false);
#endifSerial.println(F("Done!"));uint16_t c = 4;int8_t d = 1;for (int32_t i = 0; i < h; i++){gfx->drawFastHLine(0, i, w, c);c += d;if (c <= 4 || c >= 11){d = -d;}}gfx->setCursor(0, 0);gfx->setTextSize(tsa);gfx->setTextColor(MAGENTA);gfx->println(F("Arduino GFX PDQ"));if (h > w){gfx->setTextSize(tsb);gfx->setTextColor(GREEN);gfx->print(F("\nBenchmark "));gfx->setTextSize(tsc);if (ds == 12){gfx->print(F("   "));}gfx->println(F("micro-secs"));}printnice(F("Screen fill "), usecFillScreen);printnice(F("Text        "), usecText);printnice(F("Pixels      "), usecPixels);printnice(F("Lines       "), usecLines);printnice(F("H/V Lines   "), usecFastLines);printnice(F("Rectangles F"), usecFilledRects);printnice(F("Rectangles  "), usecRects);printnice(F("Triangles F "), usecFilledTrangles);printnice(F("Triangles   "), usecTriangles);printnice(F("Circles F   "), usecFilledCircles);printnice(F("Circles     "), usecCircles);printnice(F("Arcs F      "), usecFilledArcs);printnice(F("Arcs        "), usecArcs);printnice(F("RoundRects F"), usecFilledRoundRects);printnice(F("RoundRects  "), usecRoundRects);if ((h > w) || (h > 240)){gfx->setTextSize(tsc);gfx->setTextColor(GREEN);gfx->print(F("\nBenchmark Complete!"));}#ifdef CANVASgfx->flush();
#endifdelay(60 * 1000L);
}void serialOut(const __FlashStringHelper *item, int32_t v, uint32_t d, bool clear)
{
#ifdef CANVASgfx->flush();
#endifSerial.print(item);if (v < 0){Serial.println(F("N/A"));}else{Serial.println(v);}delay(d);if (clear){gfx->fillScreen(BLACK);}
}void printnice(const __FlashStringHelper *item, long int v)
{gfx->setTextSize(tsb);gfx->setTextColor(CYAN);gfx->print(item);gfx->setTextSize(tsc);gfx->setTextColor(YELLOW);if (v < 0){gfx->println(F("      N / A"));}else{char str[32] = {0};
#ifdef RTL8722DMsprintf(str, "%d", (int)v);
#elsesprintf(str, "%ld", v);
#endiffor (char *p = (str + strlen(str)) - 3; p > str; p -= 3){memmove(p + 1, p, strlen(p) + 1);*p = ',';}while (strlen(str) < ds){memmove(str + 1, str, strlen(str) + 1);*str = ' ';}gfx->println(str);}
}int32_t testFillScreen()
{uint32_t start = micros_start();// Shortened this tedious test!gfx->fillScreen(WHITE);gfx->fillScreen(RED);gfx->fillScreen(GREEN);gfx->fillScreen(BLUE);gfx->fillScreen(BLACK);return micros() - start;
}int32_t testText()
{uint32_t start = micros_start();gfx->setCursor(0, 0);gfx->setTextSize(1);gfx->setTextColor(WHITE, BLACK);gfx->println(F("Hello World!"));gfx->setTextSize(2);gfx->setTextColor(gfx->color565(0xff, 0x00, 0x00));gfx->print(F("RED "));gfx->setTextColor(gfx->color565(0x00, 0xff, 0x00));gfx->print(F("GREEN "));gfx->setTextColor(gfx->color565(0x00, 0x00, 0xff));gfx->println(F("BLUE"));gfx->setTextSize(tsa);gfx->setTextColor(YELLOW);gfx->println(1234.56);gfx->setTextColor(WHITE);gfx->println((w > 128) ? 0xDEADBEEF : 0xDEADBEE, HEX);gfx->setTextColor(CYAN, WHITE);gfx->println(F("Groop,"));gfx->setTextSize(tsc);gfx->setTextColor(MAGENTA, WHITE);gfx->println(F("I implore thee,"));gfx->setTextSize(1);gfx->setTextColor(NAVY, WHITE);gfx->println(F("my foonting turlingdromes."));gfx->setTextColor(DARKGREEN, WHITE);gfx->println(F("And hooptiously drangle me"));gfx->setTextColor(DARKCYAN, WHITE);gfx->println(F("with crinkly bindlewurdles,"));gfx->setTextColor(MAROON, WHITE);gfx->println(F("Or I will rend thee"));gfx->setTextColor(PURPLE, WHITE);gfx->println(F("in the gobberwartsb"));gfx->setTextColor(OLIVE, WHITE);gfx->println(F("with my blurglecruncheon,"));gfx->setTextColor(DARKGREY, WHITE);gfx->println(F("see if I don't!"));gfx->setTextSize(2);gfx->setTextColor(RED);gfx->println(F("Size 2"));gfx->setTextSize(3);gfx->setTextColor(ORANGE);gfx->println(F("Size 3"));gfx->setTextSize(4);gfx->setTextColor(YELLOW);gfx->println(F("Size 4"));gfx->setTextSize(5);gfx->setTextColor(GREENYELLOW);gfx->println(F("Size 5"));gfx->setTextSize(6);gfx->setTextColor(GREEN);gfx->println(F("Size 6"));gfx->setTextSize(7);gfx->setTextColor(BLUE);gfx->println(F("Size 7"));gfx->setTextSize(8);gfx->setTextColor(PURPLE);gfx->println(F("Size 8"));gfx->setTextSize(9);gfx->setTextColor(PINK);gfx->println(F("Size 9"));return micros() - start;
}int32_t testPixels()
{uint32_t start = micros_start();for (int16_t y = 0; y < h; y++){for (int16_t x = 0; x < w; x++){gfx->drawPixel(x, y, gfx->color565(x << 3, y << 3, x * y));}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endif}return micros() - start;
}int32_t testLines()
{uint32_t start;int32_t x1, y1, x2, y2;start = micros_start();x1 = y1 = 0;y2 = h - 1;for (x2 = 0; x2 < w; x2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifx2 = w - 1;for (y2 = 0; y2 < h; y2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifx1 = w - 1;y1 = 0;y2 = h - 1;for (x2 = 0; x2 < w; x2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifx2 = 0;for (y2 = 0; y2 < h; y2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifx1 = 0;y1 = h - 1;y2 = 0;for (x2 = 0; x2 < w; x2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifx2 = w - 1;for (y2 = 0; y2 < h; y2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifx1 = w - 1;y1 = h - 1;y2 = 0;for (x2 = 0; x2 < w; x2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifx2 = 0;for (y2 = 0; y2 < h; y2 += 6){gfx->drawLine(x1, y1, x2, y2, BLUE);}
#ifdef ESP8266yield(); // avoid long run triggered ESP8266 WDT restart
#endifreturn micros() - start;
}int32_t testFastLines()
{uint32_t start;int32_t x, y;start = micros_start();for (y = 0; y < h; y += 5){gfx->drawFastHLine(0, y, w, RED);}for (x = 0; x < w; x += 5){gfx->drawFastVLine(x, 0, h, BLUE);}return micros() - start;
}int32_t testFilledRects()
{uint32_t start;int32_t i, i2;start = micros_start();for (i = n; i > 0; i -= 6){i2 = i / 2;gfx->fillRect(cx - i2, cy - i2, i, i, gfx->color565(i, i, 0));}return micros() - start;
}int32_t testRects()
{uint32_t start;int32_t i, i2;start = micros_start();for (i = 2; i < n; i += 6){i2 = i / 2;gfx->drawRect(cx - i2, cy - i2, i, i, GREEN);}return micros() - start;
}int32_t testFilledCircles(uint8_t radius)
{uint32_t start;int32_t x, y, r2 = radius * 2;start = micros_start();for (x = radius; x < w; x += r2){for (y = radius; y < h; y += r2){gfx->fillCircle(x, y, radius, MAGENTA);}}return micros() - start;
}int32_t testCircles(uint8_t radius)
{uint32_t start;int32_t x, y, r2 = radius * 2;int32_t w1 = w + radius;int32_t h1 = h + radius;// Screen is not cleared for this one -- this is// intentional and does not affect the reported time.start = micros_start();for (x = 0; x < w1; x += r2){for (y = 0; y < h1; y += r2){gfx->drawCircle(x, y, radius, WHITE);}}return micros() - start;
}int32_t testFillArcs()
{int16_t i, r = 360 / cn;uint32_t start = micros_start();for (i = 6; i < cn; i += 6){gfx->fillArc(cx1, cy1, i, i - 3, 0, i * r, RED);}return micros() - start;
}int32_t testArcs()
{int16_t i, r = 360 / cn;uint32_t start = micros_start();for (i = 6; i < cn; i += 6){gfx->drawArc(cx1, cy1, i, i - 3, 0, i * r, WHITE);}return micros() - start;
}int32_t testFilledTriangles()
{uint32_t start;int32_t i;start = micros_start();for (i = cn1; i > 10; i -= 5){gfx->fillTriangle(cx1, cy1 - i, cx1 - i, cy1 + i, cx1 + i, cy1 + i,gfx->color565(0, i, i));}return micros() - start;
}int32_t testTriangles()
{uint32_t start;int32_t i;start = micros_start();for (i = 0; i < cn; i += 5){gfx->drawTriangle(cx1, cy1 - i,     // peakcx1 - i, cy1 + i, // bottom leftcx1 + i, cy1 + i, // bottom rightgfx->color565(0, 0, i));}return micros() - start;
}int32_t testFilledRoundRects()
{uint32_t start;int32_t i, i2;start = micros_start();for (i = n1; i > 20; i -= 6){i2 = i / 2;gfx->fillRoundRect(cx - i2, cy - i2, i, i, i / 8, gfx->color565(0, i, 0));}return micros() - start;
}int32_t testRoundRects()
{uint32_t start;int32_t i, i2;start = micros_start();for (i = 20; i < n1; i += 6){i2 = i / 2;gfx->drawRoundRect(cx - i2, cy - i2, i, i, i / 8, gfx->color565(i, 0, 0));}return micros() - start;
}

4.接线

直接将开发板与显示屏的两排针连接在一起就行,这里也提供一下引脚连接方式。

开发板 屏幕
2 SCK
3 SDA
10 RES
6 DC
7 CS
11 BL

5.安装库

6.测试

合宙esp32+显示屏测试相关推荐

  1. 合宙ESP32S3 CameraWebServe 测试demo

    合宙ESP32S3 CameraWebServe 合宙ESP32S3 CameraWebServe测试,我们需要一个OV2640的摄像头模组用来采集图像传输给ESP32的,这里使用的OV2640是之前 ...

  2. 合宙esp32 环境搭建和使用方法

    文章目录 1.环境搭建 2.问题 2-1:exec: "cmd": executable file not found in %PATH% 3.合宙esp32 使用 3-1引脚定义 ...

  3. Arduino框架下通过TFT_eSPI库驱动ESP32+合宙1.54“ 电子墨水屏(e-paper)显示

    Arduino框架下通过TFT_eSPI库驱动ESP32+合宙1.54" 电子墨水屏(e-paper)显示 demo演示效果 相关库 EPD_Libraries:https://github ...

  4. Arduino框架下ESP32+合宙1.54“ 电子墨水屏(e-paper)驱动显示示例

    Arduino框架下ESP32+合宙1.54" 电子墨水屏(e-paper)驱动显示示例 显示效果展示; 合宙1.54" 电子墨水屏 有关合宙1.54"电子墨水屏的介绍资 ...

  5. 合宙-icool 开发板使用手册

    概述:iCool(idea cool)手机是基于合宙Air722UG模块,移植LittleVGL,用lua脚本语言开发的一款5寸触摸屏手机产品. 目录 1.总体介绍 2.准备工作 3.功能介绍 3.1 ...

  6. 0.1.3-01 合宙CORE-ESP32-C3制作1.3寸ST7789驱动的简单相册

    本文基于aduino IDE以最简化的代码实现合宙ESP32-C3将图片传至1.3寸LCD屏幕,文末有简化前的代码及资料参考 1.需要软件有(如有需要留言,正常我每天都会看CSDN) 1.1开发环境, ...

  7. 005.Python制作客户端截屏通过合宙ESP32-C3投屏到0.96OLED

    Python制作客户端截屏通过ESP32-C3投屏到0.96'OLED 一.实现原理 Python对屏幕进行截屏,并进行数据处理 Python与ESP32-C3通过WIFI建立tcp连接 Python ...

  8. 最新动态 | 合宙MCU新品即将发布,LuatOS-SoC软硬件齐发力

    合宙在9月初首发推出MCU产品线Air101系列,搭载LuatOS开发助力快速量产,在业界引发广泛反响. 今天合宙正式发布MCU新品--Air103及其配套开发板,更多引脚将满足更丰富的需求 未来,还 ...

  9. 实测:合宙ESP32C3开发板可以直接用Arduino开发

    合宙推出了一款ESP32C3开发板,制作精良,而且9.9包邮,可谓是相当吸引人了. 但当看某宝评论的时候,会发现很多人要么说这款开发板不能用Arduino开发,要么说不适合小白使用,又有说需要用电烙铁 ...

最新文章

  1. url-pattern / /*匹配
  2. Matlab Robotic Toolbox V9.10工具箱(六):puma560 动力学建模与仿真
  3. java基础提升篇:深入剖析Java中的装箱和拆箱
  4. 解决VC6中error LNK2001 _WinMain@16错误
  5. javax.el.ELException: Provider com.sun.el.ExpressionFactoryImpl not found
  6. 使用NW.js封装微信公众号菜单编辑器为桌面应用
  7. Linux压缩和解压缩命令汇总(tar命令汇总)
  8. 计算机中的基础元素,数据结构基础
  9. sys_guid() mysql写法_PostgreSQL Oracle 兼容性之 - sys_guid()
  10. 基于Lumisoft.NET组件的POP3邮件接收和删除操作
  11. 这种情况,支付宝转账可撤回了!一定要会
  12. 高德sdk定位当前位置_高德地图定位,获取当前位置坐标
  13. 初识C语言,入门小程序
  14. 实践致知第7享:Windows如何设置文件的默认打开方式?
  15. Ceph集群增加Mon时出错:admin_socket: exception getting command descriptions: [Errno 2] No such file or direc
  16. cadence 通孔焊盘_allegro通孔类焊盘的制作方法
  17. 【BAT 面试题宝库附详尽答案解析】分布式事务实现原理
  18. 【机器学习的高等数学基础】导数的几何意义和物理意义、函数的可导性与连续性之间的关系、平面曲线的切线和法线、基本导数与微分表、微分中值定理,泰勒公式、弧微分、曲率、曲率半径、洛必达法则、渐近线的求法等
  19. 企业网盘+超融合,联想云加速的双引擎
  20. 分享一个好用的串口调试助手

热门文章

  1. linux防火墙服务无法开启,如何解决centos防火墙无法启动
  2. JAVA实验6继承与接口,java实验6继承与接口
  3. 【前端html+js】实现按下按钮显示当前时间(21位和中国国际时间)
  4. Games101笔记——Lecture 19:Cameras, Lenses and Light Fields
  5. 使用ClipFinder HD搜索和查看多个视频网站
  6. 量化噪声的大小与什么成正比_量化噪声.PPT
  7. 28家中国域名商保有量统计:有孚网络升至第十五
  8. 不得不说华为P30这场发布会让苹果着实难堪
  9. 我的世界curseforge整合包服务器搭建
  10. mysql普通索引命中_MySQL中因字段字符集不同导致索引不能命中的解决方法