问题描述
现在,我正在尝试制作一个可以上下移动的火柴人。现在我只想制作一个与火柴人一起出现的物体,但是当我这样做时,火柴人不再出现,只有物体出现。如何将火柴人和物体放在一起?
#include <LiquidCrystal.h>
LiquidCrystal lcd(2,3,4,5,6,7);
byte customChar[] = {
B01110,B01110,B00100,B10101,B01010
};
byte gameObstical[] = {
B11111,B11111,B11111
};
void setup() {
lcd.begin(16,2);
lcd.createChar(0,customChar);
lcd.home();
lcd.write(byte(0));
lcd.createChar(0,gameObstical);
lcd.write(static_cast<uint8_t>(0));
};
void loop() {
for(int position = 0; position < 13; position++) {
lcd.scrolldisplayRight();
delay(150);
int state = digitalRead(A0);
if (state != 0) {
if (state == HIGH) {
lcd.clear();
lcd.setCursor(0,1);
lcd.write(byte(0));
}
}
if (state == 0) {
if (state == LOW) {
lcd.clear();
lcd.setCursor(0,0);
lcd.write(byte(0));
}
}
}
}
我检查了接线,一切正常。一定是代码有问题。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)