title: How can I use a function to write LCD text? - Arduino
body: <p>I'm trying to create a sort of number picker. It'll show you 0 to 9 and using an X, which I will write over the number you can choose a number. As an example 01234567x9 or 0123x56789. I'm struggling however with printing this to an LCD. I'm using a tinkercad so all of my pin connections are predefined and pretty much correct. I'm using the standard tinkercad LCD and LiquidCrystal as a library.</p>
  <p>But when I use <code>lcd.print(&quot;Hello World)</code> in void loop() it continuously prints Hello World, obviously because I put it in a loop. I've tried to put it in a function but I can't quite get it to work... Some help would be perfect.</p>
  <p>This is the code I'm currently using, it returns &quot;too many arguments to function 'void PrintText()'&quot; as an error.</p>
  <pre><code>// include the library code:
  #include &lt;LiquidCrystal.h&gt;
  
  // initialize the library with the numbers of the interface pins
  LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
  char lcdtxt[] = &quot;0123456789 x&quot;;
  
  void setup() {
    // set up the LCD's number of columns and rows:
    lcd.begin(16, 2);
    // Print a message to the LCD.
   
  }
  void PrintText(){
     lcd.print(lcdtxt);
     lcd.clear();
    }
  void loop() {
    PrintText(lcdtxt);
  
  
  }
  </code></pre>