Why this sketch is not working?
hi there! want scroll text on lcd. using below sketch giving error "cannot convert 'string' 'char*' argument '1' 'void marquee(char*)". have worked?
thanks.
thanks.
code: [select]
#include <liquidcrystal.h>
// initialize library numbers of 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 lcd's number of columns , rows:
lcd.begin(numcols, numrows);
}
void loop()
{
stringone = "hello world!!";
stringtwo = "hello world!!";
stringthree = stringone + stringtwo;
marquee(stringthree);
delay(1000);
lcd.clear();
}
// function uses scrolling display message 32 bytes long
void marquee(char *text )
{
int length = strlen(text); // number of characters in text
if(length < numcols)
lcd.print(text);
else
{
int pos;
for( pos = 0; pos < numcols; pos++)
lcd.print(text[pos]);
delay(1000); // allow time read first line before scrolling
while(pos < length)
{
lcd.scrolldisplayleft();
lcd.print(text[pos]);
pos = pos + 1;
delay(300);
}
}
}
stop using string, , use char arrays instead.
(please don't sketch isn't working - decide on working/not working, code has compile , run.)
(please don't sketch isn't working - decide on working/not working, code has compile , run.)
Arduino Forum > Using Arduino > Programming Questions > Why this sketch is not working?
arduino
Comments
Post a Comment