Pages: [1]   Go Down
Author Topic: Why this sketch is not working?  (Read 273 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
Karma: 0
Posts: 83
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?


#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;

Global Moderator
Offline Offline
Brattain Member
Karma: 309
Posts: 26508
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)
« Last Edit: June 07, 2013, 08:40:26 am by AWOL » Logged

"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.

Pages: [1]   Go Up
Jump to: