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.

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


Arduino Forum > Using Arduino > Programming Questions > Why this sketch is not working?


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62