How to move a man on lcd arduino using joystick? (more information in post)

So i want to make a stickman that goes up and down on the lcd. I want the man to get moved up by my joystick, and then STAY UP until the down arrow is pressed. Here is the code so far:

#include <LiquidCrystal.h>



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);

  int state = digitalRead(A0);
  
  if (state != 0) {
    if (state == HIGH) {
   
   lcd.clear();
   lcd.setCursor(0, 0);
   lcd.write(static_cast<uint8_t>(0));

  

   }
  }

   if (state == 0){
    if (state == LOW) {

      
      lcd.clear();
      lcd.begin(16, 2);
      lcd.setCursor(0, 1);
      lcd.write(static_cast<uint8_t>(0));
      
    }
 }
  }
}

Any ideas? Sorry if my post is bad, i signed up like right now

This topic was automatically closed after 77 days. New replies are no longer allowed.