Arduino--I2C-LCD12864 中文液晶显示屏
库下载:我的百度网盘 链接:https://pan.baidu.com/s/1FZM618sLNzqj10__b0AXZw 提取码:6666
接线方法:
Arduino
库安装
将RSCG12864B(函数库)拷贝到安装目录下。如“C:\Program Files\Arduino\libraries”
实例
#include <RSCG12864B.h> //导入库 char chn[]={0XB4,0XF3,0XD1,0XA7,0XC9,0XFA,0XB5,0XE7,0XD7,0XD3,0XC9,0XCC,0XC6,0XCC,0}; //最后加0,为了让显示函数能判定何时结束 //字符串:大学生电子商铺 //字符和汉字转换成16进制(ASCII吗)工具下载地址[字符编码-CN.exe]:链接:https://pan.baidu.com/s/12U4TEn6IYcKlX2gDijygIQ 提取码:6666 char chn1[]={0XCC,0XC1,0XB9,0XC1,0XCE,0XE5,0XD6,0XD0,0}; //塘沽五中 void setup() { RSCG12864B.begin(); //串口初始化 RSCG12864B.brightness(255); //屏幕亮度 } void loop() { RSCG12864B.clear(); //屏幕清屏 RSCG12864B.print_string_16_xy(0,0,chn); //坐标0,0 显示chn里的内容 //参数1 x坐标 单位:点 //参数2:y坐标 delay(3000); RSCG12864B.print_string_16_xy(50,20,chn1); //坐标50,20 显示chn1里的内容 delay(3000); RSCG12864B.print_string_16_xy(20,40,"ILoveMCU."); delay(3000); RSCG12864B.font_revers_on(); //反白操作 RSCG12864B.font_revers_off(); //关闭反白 }
#include <RSCG12864B.h> //导入库 char chn[]={0XB4,0XF3,0XD1,0XA7,0XC9,0XFA,0XB5,0XE7,0XD7,0XD3,0XC9,0XCC,0XC6,0XCC,0}; //最后加0,为了让显示函数能判定何时结束 //字符串:大学生电子商铺 //字符和汉字转换成16进制(ASCII吗)工具下载地址[字符编码-CN.exe]:链接:https://pan.baidu.com/s/12U4TEn6IYcKlX2gDijygIQ 提取码:6666 char chn1[]={0XCC,0XC1,0XB9,0XC1,0XCE,0XE5,0XD6,0XD0,0}; //塘沽五中 void setup() { RSCG12864B.begin(); //串口初始化 RSCG12864B.brightness(255); //屏幕亮度 } void loop() { RSCG12864B.clear(); //屏幕清屏 RSCG12864B.print_string_5x7_xy(0,5,"5*7 ASCII 0123456789"); //显示5*7字体大小,不能是汉字 RSCG12864B.print_string_12_xy(20,15,"6*12/12*12 FONT"); //显示6*12/12*12字体大小 不能是汉字 delay(3000); }