想做一个测滑动电阻的装置。一个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);
} |