Hello! I'd thought I'd jump into programming for the first time with a simple hello world but I seem to have run into a bit of a block. I can't really recognize the problem but if anyone would be willing to help out, many thanks. code provided below.
#include <LiquidCrystal.h>
char rowTop[] ="hello world ";
char rowBot[] =":^) ";
void setup(){
lcd.init();
//turns on backlight
lcd.backlight();
}
void loop(){
//start position for text
lcd.setCursor(16,0);
//top text scrolls left
for(int pos =0; pos < rowTop.length; pos++){
lcd.scrollDisplayLeft();
lcd.print(rowTop[pos]);
delay(150);
//wipes data from display at set location
lcd.clear();
lcd.setCursor(15,1);
}
//bottom text scrolls left
for(int pos =0; pos < rowBot.length; pos++){
lcd.scrollDisplayLeft();
lcd.print(rowBot[pos]);
delay(150);
//wipes data from display at set location
lcd.clear();
}
See the "hello world" example in the IDE (file -> examples -> liquidcrystal -> helloworld). Get that working first. Next you can copy it to your sketch and use it as a starter for your own code.
PS
Next time please post error messages (if any). The below when I attempt to compile your code
C:\Users\sterretje\AppData\Local\Temp\arduino_7f65fe329e430c1eee4745ea793abe10\sketch_feb05a.ino: In function 'void setup()':
sketch_feb05a:8: error: 'lcd' was not declared in this scope
lcd.init();
^
C:\Users\sterretje\AppData\Local\Temp\arduino_7f65fe329e430c1eee4745ea793abe10\sketch_feb05a.ino: In function 'void loop()':
sketch_feb05a:16: error: 'lcd' was not declared in this scope
lcd.setCursor(16, 0);
^
sketch_feb05a:19: error: request for member 'length' in 'rowTop', which is of non-class type 'char [18]'
for (int pos = 0; pos < rowTop.length; pos++)
^
sketch_feb05a:31: error: request for member 'length' in 'rowBot', which is of non-class type 'char [11]'
for (int pos = 0; pos < rowBot.length; pos++)
^
C:\Users\sterretje\AppData\Local\Temp\arduino_7f65fe329e430c1eee4745ea793abe10\sketch_feb05a.ino: At global scope:
sketch_feb05a:42: error: expected declaration before '}' token
}
^
Using library LiquidCrystal at version 1.0.4 in folder: C:\Program Files (x86)\Arduino\libraries\LiquidCrystal
exit status 1
'lcd' was not declared in this scope