Function for writing to multiple I2C LCDs...
hello arduino gurus , noobs...
i have been trying solve problem, unfortunately, while now. have function write appropriate i2c lcd based on functions "string" input parameter. i'm having trouble determining how code correctly. here code:
now understand program seems ridiculous. trying solve problem using small bit of total code incorporate larger code. error getting, pertaining code, is:
'class string' has no member named 'clear'
'class string' has no member named 'setcursor'
...and 1 for other function calls follow.
i believe there simple missing/not doing correctly. in advance help.
i have been trying solve problem, unfortunately, while now. have function write appropriate i2c lcd based on functions "string" input parameter. i'm having trouble determining how code correctly. here code:
code: [select]
#include <wire.h> // needed i2c comm
#include <liquidcrystal_i2c.h> // lcd functions library
liquidcrystal_i2c left_lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, positive);
liquidcrystal_i2c center_lcd(0x26, 2, 1, 0, 4, 5, 6, 7, 3, positive);
liquidcrystal_i2c right_lcd(0x25, 2, 1, 0, 4, 5, 6, 7, 3, positive);
void setup(){
left_lcd.begin(20,4); //// initialize 20x4 i2c lcd display
center_lcd.begin(20,4); //// initialize 20x4 i2c lcd display
right_lcd.begin(20,4);
}
byte count = 0;
byte state = 0;
void loop(){
string lcd = " ";
if (state == 0){
lcd = "left_lcd";
state++;
}else if (state == 1){
lcd = "center_lcd";
state++;
}else{
lcd = "right_lcd";
state = 0;
}
print_menu(lcd);
cursor_refresh(lcd);
if(count <= 2)
count++;
else
count = 0;
delay(10000);
}
void print_menu(string lcd){
lcd.clear();
lcd.setcursor(0,0);
lcd.print("* smart-shelf menu *");
lcd.setcursor(0,1);
lcd.print(" calibrate product");
lcd.setcursor(0,2);
lcd.print(" calibrate scale");
lcd.setcursor(0,3);
lcd.print(" exit");
}
void cursor_refresh(string lcd){
if (count == 0){
lcd.setcursor(0,1);
lcd.print("-->");
lcd.setcursor(0,2);
lcd.print(" ");
lcd.setcursor(0,3);
lcd.print(" ");
}
else if (count == 1){
lcd.setcursor(0,2);
lcd.print("-->");
lcd.setcursor(0,1);
lcd.print(" ");
lcd.setcursor(0,3);
lcd.print(" ");
}
else {
lcd.setcursor(0,3);
lcd.print("-->");
lcd.setcursor(0,2);
lcd.print(" ");
lcd.setcursor(0,1);
lcd.print(" ");
}
}
now understand program seems ridiculous. trying solve problem using small bit of total code incorporate larger code. error getting, pertaining code, is:
'class string' has no member named 'clear'
'class string' has no member named 'setcursor'
...and 1 for other function calls follow.
i believe there simple missing/not doing correctly. in advance help.
Arduino Forum > Using Arduino > Programming Questions > Function for writing to multiple I2C LCDs...
arduino
Comments
Post a Comment