Error: "'lcd' does not name a type" using LiquidCrystal library I'm following an online Arduino tutorial/course and trying to make a simple moving character on an LCD screen, but for some reason I get the following error: "error: 'lcd' does not name a type". I'm using the Tinkercad simulator because my PC's USB ports died recently.
Here's my code:

#include &lt;LiquidCrystal.h&gt;

byte character[8] {
   B01111,
   B01111,
   B01111,
   B00110,
   B01111,
   B01111,
   B01001,

} ;

  LiquidCrystal lcd(12, 11, 2, 3, 4, 5);

  lcd.createChar(0, character); //error is on this line

const int Lbtnpin = 6;
const int Rbtnpin = 7;
int Lbtnprev = HIGH;
int Rbtnprev = HIGH;
int pos = 0;

void setup(){
  lcd.begin(16, 2);
  lcd.clear();
  pinMode(6, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);
}

void loop(){
  lcd.clear();
  int Lbtnstate;
  Lbtnstate = digitalRead(6);
  int Rbtnstate;
  Rbtnstate = digitalRead(7);

  if ((Lbtnprev == HIGH) &amp;&amp; (Lbtnstate == LOW) &amp;&amp; (pos &gt; 0)) {
     pos--;
  }
  if ((Rbtnprev == HIGH) &amp;&amp; (Rbtnstate == LOW) &amp;&amp; (pos &lt; 16)) {
     pos++;
  }
  lcd.setCursor(pos, 1);
  lcd.write(byte(0));
  Lbtnprev = Lbtnstate;
  Rbtnprev = Rbtnstate;
}
You cannot call methods outside of a function.
Move lcd.createChar(0, character); into setup.