2563| 1
|
7x71 RGB柔性屏测评(一)开箱及示例测试 |
本帖最后由 szjuliet 于 2020-5-29 20:17 编辑 7x71 RGB柔性屏测评(一)开箱及示例测试 7x71 RGB柔性屏测评(一)开箱及示例测试 7x71 RGB柔性屏测评(二)儿童节快乐!! 很开心得到了柔性屏的测评机会。正如在申请里所说,RGB LED灯是我最喜欢的元器件,好上手,变化多,充满魔幻。 一、开箱 很快收到了测试品,一个非常轻巧的长方形盒子 拆开后的样子,正面 拆开的样子,背面 做工真是非常的漂亮,通电后运行已写入的程序,DFROBOT向左滚动 二、测试准备: 库文件下载:https://github.com/DFRobot/DFRobot_SerialScreen771 解压缩后,将文件夹复制到Arduino文件夹下的Library中: 三、运行示例文件 运行Arduino IDE-->File-->Examples-->DFRobot_SerialScreen771-master,选择一个文件进行测试 1. 设置显示信息 滚动显示信息“DFROBOT”(不知道为什么显示不出来动图,和前面那个DFROBOT向左滚动的动图是同一个动图) [mw_shl_code=cpp,false]#include <Arduino.h> #include <HardwareSerial.h> #include <SoftwareSerial.h> #include "DFRobot_SerialScreen771.h" #ifdef ARDUINO_AVR_UNO SoftwareSerial Serial1(2, 3); //RX, TX #endif DFRobot_SerialScreen771 screen; void setup() { /*Initialize communication interface (Serial1) and debug interface (Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); /*Display string "DFRobot"*/ screen.setMessage("DFRobot"); } void loop() { }[/mw_shl_code] 2. 设置信息列表(displayMessageList.ino):每3秒显示列表中的一组信息,共8种不同信息 [mw_shl_code=cpp,false]/*! * file displayMessageList.ino * * Initialize 8 information lists M1->M8 and directly print the list of "DFRobot" in the information list. * @Display a list of previously stored values of "DFRobot" * * Copyright [DFRobot](http://www.dfrobot.com), 2016 * Copyright GNU Lesser General Public License * * version V1.0 * date 2019-6-12 */ #include <Arduino.h> #include <HardwareSerial.h> #include <SoftwareSerial.h> #include "DFRobot_SerialScreen771.h" #ifdef ARDUINO_AVR_UNO SoftwareSerial Serial1(2, 3); //RX, TX #endif DFRobot_SerialScreen771 screen; const char *s = "DFRobot"; eMoveMode_t moveMode; const char* M1 = "DFRobot"; //"A" const char* M2 = "<CRY>DFRobot"; //"B" const char* M3 = "Hi!"; //"C" const char* M4 = "<CRY>Hello!"; //"D" const char* M5 = "World!"; //"E" const char* M6 = "66"; //"F" const char* M7 = "77"; //"G" const char* M8 = "88"; //"H" void setup() { /*Initialize communication interface (Serial1) and debug interface (Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); /*Send 8 information lists to the serial screen*/ screen.setMessageList(1, M1); screen.setMessageList(2, M2); screen.setMessageList(3, M3); screen.setMessageList(4, M4); screen.setMessageList(5, M5); screen.setMessageList(6, M6); screen.setMessageList(7, M7); screen.setMessageList(8, M8); /* Prints a list of "DFRobot" in the message list, and the data of the M0 message list*/ screen.displayBanner("A"); delay(3000); /*Print data of M8 information list*/ screen.displayBanner("H"); delay(3000); /*Print data for M1 and M8 information lists*/ screen.displayBanner("AH"); delay(3000); /*Display all information lists for M0~M8*/ screen.displayBanner("ABCDEFGH"); delay(5000); } void loop() { }[/mw_shl_code] 3. 设置移动方式(setMoveMode.ino): 示例演示:左移-->右移-->保持-->下移-->上移-->闪烁,每种方式持续5秒,不断循环 参 数:
* file setMoveMode.ino * Set the movement mode of the display, such as left, right, hold, up, down, flash display, etc. * @The character string "DFRobot" is displayed, and the mobile display mode is switched once every 5s * @The string "DFRobot" sequentially performs cyclic display such as left, right, hold, up, down, and flash. * * Copyright [DFRobot](http://www.dfrobot.com), 2016 * Copyright GNU Lesser General Public License * * version V1.0 * date 2019-6-12 */ #include <Arduino.h> #include <HardwareSerial.h> #include <SoftwareSerial.h> #include "DFRobot_SerialScreen771.h" #ifdef ARDUINO_AVR_UNO SoftwareSerial Serial1(2, 3); //RX, TX #endif DFRobot_SerialScreen771 screen; void setup() { /*Initialize communication interface (Serial1) and debug interface (Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); delay(5); /*Display string "DFRobot"*/ screen.setMessage("DFRobot"); /*Set the move mode to hold*/ /*eMoveMode_t: eMove_left = left eMove_right = right eMove_hold = hold eMove_down = down eMove_up = up eMove_flash = flash */ screen.setMoveMode(eMove_hold); } void loop() { /*Switch a mobile display mode every 5s*/ eMoveMode_t buf[]= {eMove_left,eMove_right,eMove_hold,eMove_down,eMove_up,eMove_flash}; for(int i = 0; i < sizeof(buf)/sizeof(eMoveMode_t); i++){ screen.setMoveMode(buf); delay(5000); } }[/mw_shl_code] 4. 设置移动速度(setMoveSpeed.ino): level 1最慢 level 8最快 参 数:
* file setMoveSpeed.ino * Set the speed at which the string moves. * @Set the displayed moving speed level. * * Copyright [DFRobot](http://www.dfrobot.com), 2016 * Copyright GNU Lesser General Public License * * version V1.0 * date 2019-6-12 */ #include <Arduino.h> #include <HardwareSerial.h> #include <SoftwareSerial.h> #include "DFRobot_SerialScreen771.h" #ifdef ARDUINO_AVR_UNO SoftwareSerial Serial1(2, 3); //RX, TX #endif DFRobot_SerialScreen771 screen; eBrightLevel_t bright; void setup() { /*Initialize communication interface (Serial1) and debug interface (Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); delay(5); /*Display string "DFRobot"*/ screen.setMessage("DFRobot"); /*Set the display's movement mode to shift left*/ screen.setMoveMode(eMove_left); /*Set the displayed moving speed level*/ /*eBrightLevel_t: eSpeedLevel_1 = Speed class 1 eSpeedLevel_2 = Speed class 2 eSpeedLevel_3 = Speed class 3 eSpeedLevel_4 = Speed class 4 eSpeedLevel_5 = Speed class 5 eSpeedLevel_6 = Speed class 6 eSpeedLevel_7 = Speed class 7 eSpeedLevel_8 = Speed class 8 */ screen.setMoveSpeed(eSpeedLevel_1); } void loop() { }[/mw_shl_code] 5. 设置显示亮度(setBrightness.ino): level 1最暗 level 8最亮
[mw_shl_code=cpp,false]/*! * file setBrightness.ino * Set the brightness level of the display. * @Adjust the brightness level of the display. * * Copyright [DFRobot](http://www.dfrobot.com), 2016 * Copyright GNU Lesser General Public License * * version V1.0 * date 2019-6-12 */ #include <Arduino.h> #include <HardwareSerial.h> #include <SoftwareSerial.h> #include "DFRobot_SerialScreen771.h" #ifdef ARDUINO_AVR_UNO SoftwareSerial Serial1(2, 3); //RX, TX #endif DFRobot_SerialScreen771 screen; void setup() { /*Initialize communication interface (Serial1) and debug interface (Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); /*Display string "DFRobot"*/ screen.setMessage("DFRobot"); /*Set the brightness level of the display*/ /*eBrightLevel_t: eBrightLevel_1 = Brightness level 1 eBrightLevel_2 = Brightness level 2 eBrightLevel_3 = Brightness level 3 eBrightLevel_4 = Brightness level 4 eBrightLevel_5 = Brightness level 5 eBrightLevel_6 = Brightness level 6 eBrightLevel_7 = Brightness level 7 eBrightLevel_8 = Brightness level 8 */ screen.setBrightness(eBrightLevel_1); } void loop() { }[/mw_shl_code] 6. 设置显示颜色(setDisplayColor.ino):
屏幕黑色背景下依次显示红色-->黄色-->绿色-->青色-->蓝色-->紫色-->白色字体 [mw_shl_code=cpp,false]/*! * file setDisplayColor.ino * Set the color of the display background and font, a total of 8 colors of red, * yellow, green, cyan, blue, purple, white, black. * @The string "DFRobot" is displayed, the background is black, and the font color * @changes in red, yellow, green, cyan, blue, purple, and white colors every 5 seconds. * * Copyright [DFRobot](http://www.dfrobot.com), 2016 * Copyright GNU Lesser General Public License * * version V1.0 * date 2019-6-12 */ #include <Arduino.h> #include <HardwareSerial.h> #include <SoftwareSerial.h> #include "DFRobot_SerialScreen771.h" #ifdef ARDUINO_AVR_UNO SoftwareSerial Serial1(2, 3); //RX, TX #endif DFRobot_SerialScreen771 screen; void setup() { /*Initialize communication interface (Serial1) and debug interface (Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); delay(5); /*Display string "DFRobot"*/ screen.setMessage("DFRobot"); /*Set the string to display the background and font color, set it to red on the black background*/ screen.setDispalyColor(eColor_red, eColor_black); } void loop() { /*Switch one font color every 5s*/ eColorMode_t backgroud,font; backgroud = eColor_black; eColorMode_t buf[]= {eColor_red, eColor_yellow, eColor_green, eColor_cyan, eColor_blue, eColor_purple, eColor_white}; for(int i = 0; i < sizeof(buf)/sizeof(eColorMode_t); i++){ font = buf; screen.setDispalyColor(font, backgroud); delay(5000); } }[/mw_shl_code] 7.设置全屏颜色(示例文件setScreenColor.ino): 颜色依次为红色-->黄色-->绿色-->青色-->蓝色-->紫色-->白色-->黑色 [mw_shl_code=cpp,false]/*! * file setScreenColor.ino * Full screen lighting, full screen display red, yellow, green, blue, blue, purple, white and other colors * @Light up the full screen, switch the color every 5s, and cycle * * Copyright [DFRobot](http://www.dfrobot.com), 2016 * Copyright GNU Lesser General Public License * * version V1.0 * date 2019-6-12 */ #include <Arduino.h> #include <HardwareSerial.h> #include <SoftwareSerial.h> #include "DFRobot_SerialScreen771.h" #ifdef ARDUINO_AVR_UNO SoftwareSerial Serial1(2, 3); //RX, TX #endif DFRobot_SerialScreen771 screen; void setup() { /*Initialize communication interface (Serial1) and debug interface (Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); /*Set screen color*/ /*eColorMode_t: eColor_red = red eColor_yellow = yellow eColor_green = green eColor_cyan = cyan eColor_blue = blue eColor_purple = purple eColor_white = white eColor_black = black */ screen.setFullScreenColor(eColor_black); } void loop() { /*Switch one screen color every 5s*/ eColorMode_t buf[]= {eColor_red, eColor_yellow, eColor_green, eColor_cyan, eColor_blue, eColor_purple, eColor_white}; for(int i=0; i < sizeof(buf)/sizeof(eColorMode_t); i++){ screen.setFullScreenColor(buf); delay(5000); } }[/mw_shl_code] 四、命令总结 [mw_shl_code=cpp,false]void setup() { /*初始化通讯接口(Serial1)和调试接口(Serial)*/ Serial.begin(115200); Serial1.begin(19200); screen.begin(Serial1); screen.setDbgSerial(Serial); delay(5); /*显示字符串 "DFRobot"*/ screen.setMessage("DFRobot"); /*设置字符移动方向*/ screen.setMoveMode(eMove_left); /*设置字符移动速度*/ screen.setMoveSpeed(eSpeedLevel_8); /*设置显示亮度级别*/ screen.setBrightness(eBrightLevel_1); /*设置屏幕颜色*/ screen.setFullScreenColor(eColor_black); /*设置屏幕背景色和字体颜色:黑色背景红色字体*/ screen.setDispalyColor(eColor_red, eColor_black); }[/mw_shl_code] 五、初试体会 RGB柔性屏做工精良,色彩饱满,产品维库清晰,简单易上手。 接下来将尝试在其他控制器上使用柔性屏,并搭配其他元器件使用。 |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed