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:

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.

i looking @ example try mimic little progress.
http://forum.arduino.cc/index.php/topic,46910.0.html



Arduino Forum > Using Arduino > Programming Questions > Function for writing to multiple I2C LCDs...


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support