Is there a way to put two special characters in LCD?

  arduino, arduino-c++, c++, lcd

Right now, I’m trying to make a stickman that moves up and down. Now I just want to make a object that appears along with the stickman, However when I do this, the stickman doesn’t appear anymore and just the object appears. How can I put the stickman and the object next to each other?

#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7);

byte customChar[] = {
  B01110,
  B01110,
  B01110,
  B00100,
  B01110,
  B10101,
  B00100,
  B01010
};


byte gameObstical[] = {
  B11111,
  B11111,
  B11111,
  B11111,
  B11111,
  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));
    }
  }
  }
}

I checked the wiring and all is correct. Must be something with the code.

Source: Windows Questions C++

LEAVE A COMMENT