有没有遇到过oled第一次显示正常,
刷新后变成了乱码这种问题,
,ps:小妹只有1积分,请各位多担待,谢谢大家的帮忙主要代码如下unsigned char str[28]={'1','2','6','3','7','2','5','3','3','6',
'8','2','0','0','0','3','4','0','7','9','1','2','4','6','3','8','3'};
void display(unsigned char buff[])
{
dis11[0]=buff[1];
dis11[1]=buff[2];
dis11[2]='C';
dis11[3]=buff[3];
dis11[4]=buff[4];
dis11[5]='%';
dis11[6]='R';
dis11[7]='H';
LCD_P8x16Str(0,0,"Air:");
LCD_P8x16Str(30,0,dis11);
dis22[0]=buff[12];
dis22[1]=buff[13];
dis22[2]=buff[14];
dis22[3]=buff[15];
dis22[4]=buff[16];
dis22[5]='l';
dis22[6]='x';
LCD_P8x16Str(0,2,"Light:");
LCD_P8x16Str(50,2,dis22);
dis33[0]=buff[17];
dis33[1]='.';
dis33[2]=buff[18];
dis33[3]=buff[19];
dis33[4]=buff[20];
dis33[5]='v';
LCD_P8x16Str(0,4,"CO2:");
LCD_P8x16Str(30,4,dis33);
dis44[0]=buff[5];
dis44[1]=buff[6];
dis44[2]='.';
dis44[3]=buff[7];
dis44[4]='C';
dis44[5]=buff[8];
dis44[6]=buff[9];
dis44[7]='.';
dis44[8]=buff[10];
dis44[9]='%';
// dis44[10]='R';
// dis44[11]='H';
LCD_P8x16Str(0,6,"Soil1:");
LCD_P8x16Str(40,6,dis44);
}
void main(void)
{
LCD_Init(); //oled 初始化
while(1)
{
//LCD_Fill(0xff); //屏全亮
//LCD_Fill(0x00); //屏全灭
display(str);
}
}
一周热门 更多>