Invalid header file in tinkercard

i have writen a code in tinkercard and i am getting a invalid geader file error. please help.

// C++ code
//
#include <Adafruit_LiquidCrystal.h>

#include <IRremote.h>

int Passkey = 0;

Adafruit_LiquidCrystal lcd_1(0);

// Map the IR code to the corresponding remote button.
// The buttons are in this order on the remote:
//    0   1   2
//    4   5   6
//    8   9  10
//   12  13  14
//   16  17  18
//   20  21  22
//   24  25  26
//
// Return -1, if supplied code does not map to a key.
int mapCodeToButton(unsigned long code) {
  // For the remote used in the Tinkercad simulator,
  // the buttons are encoded such that the hex code
  // received is of the format: 0xiivvBF00
  // Where the vv is the button value, and ii is
  // the bit-inverse of vv.
  // For example, the power button is 0xFF00BF000

  // Check for codes from this specific remote
  if ((code & 0x0000FFFF) == 0x0000BF00) {
    // No longer need the lower 16 bits. Shift the code by 16
    // to make the rest easier.
    code >>= 16;
    // Check that the value and inverse bytes are complementary.
    if (((code >> 8) ^ (code & 0x00FF)) == 0x00FF) {
      return code & 0xFF;
    }
  }
  return -1;
}

int readInfrared() {
  int result = -1;
  // Check if we've received a new code
  if (IrReceiver.decode()) {
    // Get the infrared code
    unsigned long code = IrReceiver.decodedIRData.decodedRawData;
    // Map it to a specific button on the remote
    result = mapCodeToButton(code);
    // Enable receiving of the next value
    IrReceiver.resume();
  }
  return result;
}

void setup()
{
  Serial.begin(9600);
  lcd_1.begin(16, 2);
  IrReceiver.begin(5);


  Serial.println("system initalizing");
  lcd_1.setBacklight(1);
  lcd_1.display();
  lcd_1.clear();
  Serial.println("welcome screen displayed");
  lcd_1.setCursor(4, 0);
  lcd_1.print("welocme!");
  delay(3000); // Wait for 3000 millisecond(s)
  lcd_1.clear();
  lcd_1.setCursor(0, 0);
  lcd_1.print("lets get set up!");
  Serial.println("printed lets get set up to lcd");
  delay(3000); // Wait for 3000 millisecond(s)
  lcd_1.clear();
  lcd_1.setCursor(0, 0);
  lcd_1.print("please hit a key");
  lcd_1.setCursor(1, 1);
  lcd_1.print("it will be your ");
  Serial.println("please hit a key was printed to lcd");
  delay(3000); // Wait for 3000 millisecond(s)
  lcd_1.clear();
  lcd_1.setCursor(0, 0);
  lcd_1.print("code key. this ");
  lcd_1.setCursor(1, 1);
  lcd_1.print("key will disarm");
  Serial.println("this key will disarm was printed to lcd");
  delay(3000); // Wait for 3000 millisecond(s)
  lcd_1.clear();
  lcd_1.setCursor(0, 0);
  lcd_1.print("your system");
  Serial.println("your system was printed to lcd");
  if (1 > -1) {
    Passkey = readInfrared();
  }
}

I don't use tinkercad, but could it be that it doesn't know about those libraries?

that was exactly right! thank you for your help!

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