步骤1:组件:
-arduino uno开发板* 1
-usb电缆* 1
-lcd1602 * 1
-电位计(50kω)* 1
-面包板* 1
-跳线
步骤2:原理
通常,lcd1602具有并行端口,也就是说,它将同时控制多个引脚。 lcd1602可以分为八端口和四端口连接。如果使用八端口连接,则arduino uno板的所有数字端口几乎全部被占用。如果要连接更多的传感器,将没有可用的端口。因此,这里使用四端口连接是为了更好的应用。
lcd1602的引脚及其功能
vss:接地”
vdd:连接到+ 5v电源
vo:调整对比度
rs:寄存器选择引脚,用于控制将数据写入lcd存储器的位置。您可以选择保存屏幕上显示内容的数据寄存器,也可以选择指令寄存器,lcd控制器在其中查找有关下一步操作的指令。
r/w:a读/写入引脚以在读取和写入模式之间进行选择
e:启用引脚,当接收到高电平(1)时读取信息。当信号从高电平变为低电平时,将执行指令。
d0-d7:读取和写入数据
a和k:控制lcd背光的引脚。将k连接至gnd,将a连接至3.3v。打开背光灯,您会在相对黑暗的环境中看到清晰的字符。
步骤3:原理图
步骤4:步骤
将k连接至gnd,将a连接至3.3 v,然后lcd1602的背光将打开。将vss连接至gnd,将lcd1602连接至电源。将vo连接到电位计的中间引脚-可以调节屏幕显示的对比度。将rs连接到d4,将r/w引脚连接到gnd,这意味着您可以将字符写入lcd1602。将e连接到引脚6,lcd1602上显示的字符由d4-d7控制。对于编程,通过调用函数库对其进行了优化。
步骤1:
构建电路。
步骤2:
下载来自https://github.com/primerobotics/arduino的代码
步骤3:
将草图上传到arduino uno开发板
单击“上传”图标将代码上传到控制板上。
如果窗口底部的
出现“完成上传”,则表示草图已成功上传。
注意:您可能需要调整lcd1602上的电位计,直到其清晰显示为止。
第5步:代码
//lcd1602
//you should now
see your lcd1602 display the flowing characters “primerobotics” and
“hello, world”
//email:info@primerobotics.in
//website:www.primerobotics.in
#include
// include the library code
/**********************************************************/
char
array1[]=“ primerobotics
”; //the string to print on
the lcd
char
array2[]=“hello, world!
”; //the string to print on
the lcd
int tim =
250; //the value of delay time
// initialize the library
with the numbers of the interface pins
liquidcrystal
lcd(4, 6, 10, 11, 12, 13);
/*********************************************************/
void setup()
{
lcd.begin(16, 2); // set up the lcd‘s number of columns and
rows:
}
/*********************************************************/
void loop()
{
lcd.setcursor(15,0); // set the cursor to column 15, line 0
for ( int positioncounter1 = 0;
positioncounter1 《 26; positioncounter1++)
{
lcd.scrolldisplayleft(); //scrolls the contents of the display one
space to the left.
lcd.print(array1[positioncounter1]); // print a message to the lcd.
delay(tim); //wait for 250 microseconds
}
lcd.clear(); //clears the lcd screen and positions the
cursor in the upper-left corner.
lcd.setcursor(15,1); // set the cursor to column 15, line 1
for (int positioncounter2 = 0;
positioncounter2 《 26; positioncounter2++)
{
lcd.scrolldisplayleft(); //scrolls the contents of the display one
space to the left.
lcd.print(array2[positioncounter2]); // print a message to the lcd.
delay(tim); //wait for 250 microseconds
}
lcd.clear(); //clears the lcd screen and positions the
cursor in the upper-left corner.
}
/**********************************************************/
步骤6:代码分析
无线红外耳机发射机
魅族平板要来了吗?30日发布的魅蓝平板被曝光
示波器的垂直分辨率的意义
艾德克斯大功率电子负载在DC-DC转换器测试中的解决方案
带您解锁“半导体先进技术创新发展和机遇大会”最佳打开方式!
如何使用LCD1602显示字符和字符串
毕托巴流量计的组成结构和安装注意事项
设备与晶圆再生厂辛耘上市 半导体族群添新成员
开放式VPX系统帮助快速交付无人机项目
gpu和显卡是什么关系
6mm储能连接器的特性
场效应管与晶体三极管的比较
采购电子万能试验机能找哪些生产商?
睿士达(RESDA)独特的电子滤网技术
国家电网公司将加快推进三型两网世界一流战略落地
历史数据怎样阿里进行储存
利用单片机的I/O口通过软件模拟SPI总线的实现方法
四大战略助力汽车营销体系转型升级
新品voc在线监测设备推荐厂家
2030年中国汽车芯片市场规模将达290亿美元,国产传感器厂商湾测获近亿元Pre-A轮融资