Hey all,
First of all, I’m new to Arduino so I’m sorry for any stupid questions.
Now, I am working with a SainSmart IIC/I2C/TWI Serial 2004 20x4 LCD screen and an Arduino Uno, and while the screen backlight will blink, nothing actually prints. I am using the Malpartida library and have tried everything. The address for the board is definitely 0x3F (I have run a scanner), but no matter what I do it refuses to print. I found this code somewhere on this forum and modified it a bit, but I can’t find anything wrong… (and yes, SDA and SCL are plugged into A4 and A5, respectively). Please help!
/*
** Example Arduino sketch for SainSmart I2C LCD2004 adapter for HD44780 LCD screens
** Readily found on eBay or http://www.sainsmart.com/
** The LCD2004 module appears to be identical to one marketed by YwRobot
**
** LICENSE: GNU General Public License, version 3 (GPL-3.0)
** NOTE: I2C pins are A4 SDA, A5 SCL
** Don't forget to use the new LiquidCrystal Library.
*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x3F // Define I2C Address where the SainSmart LCD is
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin, BACKLIGHT_PIN, POSITIVE);
void setup()
{
lcd.begin (20,4);
// Switch on/off the backlight
for(int i = 0; i< 3; i++)
{
lcd.backlight();
delay(250);
lcd.noBacklight();
delay(250);
}
lcd.backlight(); // finish with backlight on
// Position cursor and write some text
lcd.home (); // go to the first line, first character
lcd.print("test. ");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print("todo bien. ");
lcd.setCursor ( 0, 2 ); // go to the third line
lcd.print("Nice LCD! ");
}
void loop()
{
}
Thank you so much!