Go Down

Topic: Why this sketch is not working? (Read 462 times) previous topic - next topic


Hi There!  I want to scroll the text on the LCD.  I am using the below sketch but its giving error "cannot convert 'String' to 'char*' for argument '1' to 'void marquee(char*)". What I have to do to get this worked?


Code: [Select]
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int numRows = 2;
const int numCols = 16;
String stringOne;
String stringTwo;
String stringThree;
void setup()
  // set up the LCD's number of columns and rows:
  lcd.begin(numCols, numRows);
void loop()

  stringOne = "HELLO WORLD!!";
  stringTwo = "hello world!!";
  stringThree = stringOne + stringTwo;

// this function uses scrolling to display a message up to 32 bytes long
void marquee(char  *text )
  int length = strlen(text); // the number of characters in the text
  if(length < numCols)
    int pos;
    for( pos = 0; pos < numCols; pos++)
    delay(1000); // allow time to read the first line before scrolling
    while(pos < length)
      pos = pos + 1;


Jun 07, 2013, 03:37 pm Last Edit: Jun 07, 2013, 03:40 pm by AWOL Reason: 1
Stop using String, and use char arrays instead.

(please don't say the sketch isn't working - to decide on working/not working, the code has to compile and run.)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131