Invalid Header File in tinkercad

Hello all! I am aware of the existence of other topics but it did not help my case.
Tinkercad returns the invalid header file error. Arduino IDE doesnt return any errors while compiling but the code is not running on the board even after checking the wiring multiple times.

#include <Wire.h>
#include <Adafruit_LiquidCrystal.h>

#define LCD_ADDRESS 0x27
#define LCD_COLUMNS 16
#define LCD_ROWS 2

Adafruit_LiquidCrystal lcd(LCD_COLUMNS, LCD_ROWS); 

int yellow = 3;
int green = 2;  
int blue = 1;   
int red = 0;    

int buzzer = 12;  
int buttonPins[] = {8, 9, 10, 11};  

int sequence[100];
int playerSequence[100];
int sequenceLength = 1;
int playerTurn = false;

void setup() {
  pinMode(yellow, OUTPUT);
  pinMode(green, OUTPUT);
  pinMode(blue, OUTPUT);
  pinMode(red, OUTPUT);
  pinMode(buzzer, OUTPUT);

  for (int i = 0; i < 4; i++) {
    pinMode(buttonPins[i], INPUT_PULLUP);
  }

  lcd.begin(LCD_COLUMNS, LCD_ROWS); 
  lcd.setBacklight(1); 
  lcd.setCursor(0, 0);
  lcd.print("Simon Game");
  delay(1000);
  lcd.clear();

  randomSeed(analogRead(0)); 
}

void loop() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Level: " + String(sequenceLength));

  delay(1000);

  generateSequence();
  playSequence();

  playerTurn = true;
  int playerIndex = 0;

  while (playerTurn) {
    for (int i = 0; i < 4; i++) {
      if (digitalRead(buttonPins[i]) == LOW) {
        playButton(i);
        playerSequence[playerIndex] = i + 1;

        if (playerSequence[playerIndex] != sequence[playerIndex]) {
          playerTurn = false;
          gameOver();
          break;
        }

        playerIndex++;

        if (playerIndex == sequenceLength) {
          playerTurn = false;
          delay(500);
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("Next Level!");
          delay(1000);
        }
        delay(200);
      }
    }
  }

  delay(500);
  sequenceLength++;
}

void generateSequence() {
  for (int i = 0; i < 100; i++) {
    sequence[i] = random(1, 5); 
  }
}

void playSequence() {
  for (int i = 0; i < sequenceLength; i++) {
    playButton(sequence[i] - 1);
    delay(500);
    turnOffButtons();
    delay(200);
  }
}

void playButton(int button) {
  switch (button) {
    case 0:
      digitalWrite(yellow, HIGH);
      tone(buzzer, 440, 300);
      break;
    case 1:
      digitalWrite(green, HIGH);
      tone(buzzer, 523, 300);
      break;
    case 2:
      digitalWrite(blue, HIGH);
      tone(buzzer, 659, 300);
      break;
    case 3:
      digitalWrite(red, HIGH);
      tone(buzzer, 783, 300);
      break;
  }
}

void turnOffButtons() {
  digitalWrite(yellow, LOW);
  digitalWrite(green, LOW);
  digitalWrite(blue, LOW);
  digitalWrite(red, LOW);
}

void gameOver() {
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Game Over!");
  lcd.setCursor(0, 1);
  lcd.print("Level: " + String(sequenceLength - 1));
  delay(2000);

  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Restarting...");
  delay(2000);

  sequenceLength = 1;
  lcd.clear();
}

This is the tinkercad link if it offers any help.
Thank you for any help.

So I'm curious why you are asking at an Arduino forum instead of asking TinkerCad people since the problem you have appears to be with TinkerCad and not Arduino.

Are you using an I2C display, or is it directly connected? The constructor is not correct for an I2C display.

You are initialising the lcd instance in the wrong way. Change

Adafruit_LiquidCrystal lcd(LCD_COLUMNS, LCD_ROWS);

to

Adafruit_LiquidCrystal lcd(0);

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.