极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 285|回复: 0

求助,LCD12864显示问题

[复制链接]
发表于 2017-10-12 23:32:44 | 显示全部楼层 |阅读模式
想做一个测滑动电阻的装置。一个UNO板子和一个LCD12864模块。知道怎么获取模拟IO口的数据,但是怎么在LCD12864上显示出来,用的库是"LCD12864RSPI.h",后面不知道怎么编程了,请指教一下,谢谢大家,下面是代码。
/*
LCD  Arduino
PIN1 = GND
PIN2 = 5V
RS(CS) = 8;
RW(SID)= 9;
EN(CLK) = 3;
PIN15 PSB = GND;
*/

#include "LCD12864RSPI.h"
#define AR_SIZE( a ) sizeof( a ) / sizeof( a[0] )

unsigned char show0[]={0xB5,0xE7,0xD7,0xE8,0xD7,0xE8,0xD6,0xB5};//电阻阻值
unsigned char show1[]="A0:";
unsigned char show2[]="A1:";
unsigned char show3[]="A2:";
unsigned char show4[]="A3:";
unsigned char show5[]="A4:";
unsigned char show6[]="A5:";

void setup()
{
LCDA.Initialise(); // 屏幕初始化
delay(100);
}

void loop()
{
LCDA.CLEAR();//清屏

int A0=analogRead=(A0); //读取UNO上的6个模拟IO口的数据并转成整数
int A1=analogRead=(A1);
int A2=analogRead=(A2);
int A3=analogRead=(A3);
int A4=analogRead=(A4);
int A5=analogRead=(A5);

delay(100);
LCDA.DisplayString(0,2,show0,AR_SIZE(show0));//第一行第三格开始,显示文字电阻阻值
delay(100);
LCDA.DisplayString(1,0,show1,AR_SIZE(show1));//第二行第一格开始,显示“A0”
delay(100);
LCDA.DisplayString(1,4,show2,AR_SIZE(show2));//第二行第五格开始,显示“A1”
delay(100);
LCDA.DisplayString(2,0,show3,AR_SIZE(show3));//
delay(100);
LCDA.DisplayString(2,4,show4,AR_SIZE(show4));//
delay(100);
LCDA.DisplayString(3,0,show5,AR_SIZE(show5));//
delay(100);
LCDA.DisplayString(3,4,show6,AR_SIZE(show6));//
delay(5000);

}
回复

使用道具 举报

高级模式  
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊 ( 浙ICP备09023225号 )

GMT+8, 2017-10-23 14:07 , Processed in 0.038486 second(s), 6 queries , File On.

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表