Go Down

Topic: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno (Read 18 times) previous topic - next topic

NickPyner

#55
Jan 03, 2013, 11:10 pm Last Edit: Jan 03, 2013, 11:13 pm by NickPyner Reason: 1
We have the same library and the display should probably work the same. The display is disconcerting on start-up and you might think it is faulty. The light comes on and then goes goes off, then comes on fully operational.

Here is the start of a clock. Note that I don't define the backlight pin.

Code: [Select]
//Arduino 1.0+ Only
//Arduino 1.0+ Only

#include <LiquidCrystal_I2C.h>
#include "Wire.h"
#define DS1307_ADDRESS 0x68

LiquidCrystal_I2C lcd(0x27,20,4);  

void setup(){
 Wire.begin();
 Serial.begin(9600);
 lcd.init();  
   delay(1000);
lcd.clear();
     lcd.backlight();  //Backlight ON if under program control
     lcd.setCursor(0,0);
 // Print a message to the LCD.
lcd.print("Today it is");

}

void loop(){
 printDate();
 delay(1000);

}

worsethenu

Thanks for the reply! I gave it shot but it did not work.

I changed this:
#include "Wire.h"
   to
#include <Wire.h>

The line below however now throws the error: invalid conversion from 'int' to 't_backlighPol'
LiquidCrystal_I2C lcd(0x27,20,4);

I've been trying a bunch of different things and i can get the LCD to fully light and blink the cursor if the only thing in the loop is lcd.setCursor(X,Y); if I put anything else in the loop the LCD either does not illuminate or dims by 50+%.

NickPyner

#57
Jan 04, 2013, 12:39 am Last Edit: Jan 04, 2013, 01:07 am by NickPyner Reason: 1
I didn't realise I had "wire.h" and not <wire.h>. I can only conclude it makes no difference!

(EDIT)

I've changed it and it works the same.

Also Dafes looks the same as mine, except he is using 16x4 instead of 20x4. The backlight bit is the same.

dafes

Hi hopes this helps:

Code: [Select]

#include <Wire.h>
#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,16,4);  // set the LCD address to 0x27 for a 16 chars and 4 line display



void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  lcd.init();                      // initialize the lcd
  lcd.backlight();
lcd.print("Test");
}

void loop() {


}


void Test()
{
  lcd.print("Test");
}


I'have tried this with the  followign  I2C Libary┬┤s
http://www.exp-tech.de/service/library/2004%20LiquidCrystal_I2C.rar
http://www.exp-tech.de/service/library/LiquidCrystal_I2C2004V1.rar




joshpit2003

Hey Guys.
Firstly: Thanks for all the great info about the SainSmart LCD2004.
I got it working following Andrews advice.

But now I have a problem:

I'm trying to use the Wireless SD Shield:
http://arduino.cc/en/Main/ArduinoWirelessShield
w/ the Serial LCD described in this topic.

I can get the LCD to work, but not the SD.
fm says:
"Just create two objects (variables) initialising them correctly and they will work. "

can anyone please explain that to me?
The only wires coming off the LCD2004 are:

GND
VCC
SDA
SCL

and I currently have them wired:

GND - arduino GND
VCC - arduino 5V
SDA - arduino A4
SCL - arduino A5

also the Wireless SD shield uses pin 4 as the SDCS (chip-select).

Any help is appreciated.
Thanks!

Go Up