Lets say i want to make a game. That whenever the joystick is moved, a message pops up on the lcd. Using if statements, i could do that. But when i do, absolutely nothing happens. I'm trying to make letters replace a stickman that slides across the screen. Here is the code:
#include <LiquidCrystal.h> int state = digitalRead(8); LiquidCrystal lcd(1, 2, 4, 5, 6, 7); byte customChar[] = { B01110, B01110, B01110, B00100, B01110, B10101, B00100, B01010 }; void setup() { lcd.begin(16, 2); lcd.createChar(0, customChar); lcd.home(); lcd.write(static_cast<uint8_t>(0)); } void loop() { for(int position = 0; position < 13; position++) { lcd.scrollDisplayRight(); delay(150); if (state != 0) { if (state == HIGH) { lcd.clear(); lcd.print("Hello!"); } } } } Is there a way to fix this issue? because when i do, like i said, nothing happens...
https://stackoverflow.com/questions/66773767/is-there-a-way-to-make-a-lcd-react-to-a-joystick March 24, 2021 at 10:05AM
没有评论:
发表评论