LiquidCrystal函数库怎么加载不出来-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1829|回复: 3

[未解决] LiquidCrystal函数库怎么加载不出来

[复制链接]
发表于 2020-12-22 16:34 | 显示全部楼层 |阅读模式
#include <Wire.h>
#include <DS3231.h>
#include <LiquidCrystal.h>
DS3231 Clock;
bool h12,PM,Century=false;
byte year,month,date,DoW,hour,minute,second;
LiquidCrystal lcd(12,11,2,3,4,5,6,7,8,9,10);

void setup() {
  Wire.begin();
  Clock.setSecond(50);
  Clock.setMinute(59);
  Clock.setHour(11);
  Clock.setDoW(5);
  Clock.setDate(31);
  Clock.setMonth(5);
  Clock.setYear(13);


}
void Pritime()
{
  int second,minute,hour,date,month,year,dow,temperature;
  second=Clock.getSecond();
  minute=Clock.getMinute();
  hour=Clock.getHour(h12,PM);
  date=Clock.getDate();
  month=Clock.getMonth(Century);
  year=Clock.getYear();
  dow=Clock.getDoW();
  temperature=Clock.getTemperature();
  lcd.setCursor(0,0);
  lcd.print("20");
  if(year>=10)
  {
    lcd.print(year,DEC);
  }
  else
  {
    lcd.print("0");
    lcd.print(year,DEC);
  }
  lcd.print('-');
  lcd.setCursor(5,0);
  if (month>=10)
  {
    lcd.print(month,DEC);
  }
  else
  {
    lcd.print("0");
    lcd.print(month,DEC);

  }
  lcd.print('-');
  lcd.setCursor(8,0);
  if(date>=10)
  {
    lcd.print(date,DEC);
  }
  else
  {
    lcd.print("0");
    lcd.print(date,DEC);
  }
lcd.setCursor(11,0);
switch (dow)
{
  case 1:
  lcd.print("Mon");
  break;
  case2:
  lcd.print("Tue");
  break;
  case 3:
  lcd.print("Wed");
  break;
  case 4:
  lcd.print("Thu");
  break;
  case 5:
  lcd.print("Fri");
  break;
  case 6:
  lcd.print("Sat");
  break;
  case 7:
  lcd.print("Sun");
  break;
}
lcd.LCD_SET_XY(1,0);
if (hour>=10)
{
  lcd.print(hour,DEC);
}
else
{
  lcd.print("0");
  lcd.print(hour,DEC);
}
lcd.print(':');
lcd.LCD_SET_XY(1,3);
if(minute>=10)
{
  lcd.print(minute,DEC);
}
else
{
  lcd.print("0");
  lcd.print(minute,DEC);
}
lcd.print(':');
lcd.LCD_SET_XY(1,6);
if(second>=10)
{
  lcd.print(second,DEC);
}
else
{
  lcd.print("0");
  lcd.print(second,DEC);
}
lcd.LCD_SET_XY(1,12);
lcd.print(temperature);
lcd.write(0xdf);
lcd.print("C");

}

void Tictime() {
  lcd.LCD_SET_XY(1,2);
  lcd.print(' ');
  lcd.LCD_SET_XY(1,5);//这里出现了一点小问题为什么显示“'class LiquidCrystal' has no member named 'LCD_SET_XY'”
  lcd.print(' ');

}

void loop()
{
  unsigned long Rt=millis()%1000;
  if(Rt<500)
  {
    Pritime();

  }
  else
  {
    Tictime();
  }
}

刚刚接触ARDUINO还不太上手,谢谢大神指导

发表于 2020-12-23 03:18 | 显示全部楼层
lcd.setCursor(1, 5);
 楼主| 发表于 2020-12-23 13:31 | 显示全部楼层

哦哦,感谢感谢
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-29 17:37 , Processed in 0.141972 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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