Hi,
So I've got two 40x2 character lcds and I'm using the LCD3Wire library to drive them, via two 4094 shift registers. My problem is that which ever lcd object is created last becomes the only on that gets used. For example:
include <LCD3Wire.h>
// Arduino pins
#define LCD_LINES 2 // number of lines in your display
#define LCD2_LINES 2
#define DOUT_PIN 11 // Dout pin
#define STR_PIN 12 // Strobe pin
#define CLK_PIN 10 // Clock pin
#define STR2_PIN 9 // Strobe pin for lcd 2
#define DOUT2_PIN 8 // Dout pin for lcd 2
#define CLK2_PIN 7 // Clock pin for lcd 2
//create object to control an LCD.
LCD3Wire lcd2 = LCD3Wire(LCD2_LINES, DOUT2_PIN, STR2_PIN, CLK2_PIN);
LCD3Wire lcd = LCD3Wire(LCD_LINES, DOUT_PIN, STR_PIN, CLK_PIN);
void setup() {
lcd.init();
lcd2.init();
}
void loop() {
lcd.printIn("This is a test of display one.");
delay(500);
lcd.clear();
lcd2.printIn("This is a test of display two.");
delay(500);
lcd2.clear();
}
Results in the first LCD, (using the object lcd) printing "This is display one" as well as "This is display two". If the lcd2 object had been created last it would display the same thing while the other did nothing. So somehow both the lcd objects end up pointing at the same physical device even though their constructors are given different values. The last one created seems to overwrite the initialization of the previous.
I'm assuming that it is some sort of constructor issue with the library itself but I'm a little rusty. Again I assume somehow the variables for the pins are being shared by both instantiations of the LCD3Wire objects, I just don't know where to go from here. Can anyone help or point me in the right direction.
EDIT: lcd and lcd2 are not static anymore, no change.