ive hooked my uno board to my display (16x2 with LCM1602 IIC V1 back board) and the sketch never loads and "complains" that it needs an IIC address. I did find and run a test sketch that finds the address which is 0x27. but when enter the address it still load load the sketch to the uno. im very new to this arduino and I have started doing the simplest sketchs right up till now when trying the "hello world" project.
/* YourDuino.com Example Software Sketch
16 character 2 line I2C Display
Backpack Interface labelled "YwRobot Arduino LCM1602 IIC V1"
terry@yourduino.com */
/*-----( Import needed libraries )-----*/
#include <Wire.h> // Comes with Arduino IDE
// Get the LCD I2C Library here:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
// Move any other LCD libraries to another folder or delete them
// See Library "Docs" folder for possible commands etc.
#include <LiquidCrystal_I2C.h>
/*-----( Declare Constants )-----*/
/*-----( Declare objects )-----*/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
/*-----( Declare Variables )-----*/
//NONE
void setup() /*----( SETUP: RUNS ONCE )----*/
{
Serial.begin(9600); // Used to type in characters
lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines, turn on backlight
// ------- Quick 3 blinks of backlight -------------
for(int i = 0; i< 3; i++)
{
lcd.backlight();
delay(250);
lcd.noBacklight();
delay(250);
}
lcd.backlight(); // finish with backlight on
//-------- Write characters on the display ------------------
// NOTE: Cursor Position: (CHAR, LINE) start at 0
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print("Hello, world!");
delay(1000);
lcd.setCursor(0,1);
lcd.print("HI!YourDuino.com");
delay(8000);
// Wait and then tell user they can start the Serial Monitor and type in characters to
// Display. (Set Serial Monitor option to "No Line Ending")
lcd.clear();
lcd.setCursor(0,0); //Start at character 0 on line 0
lcd.print("Use Serial Mon");
lcd.setCursor(0,1);
lcd.print("Type to display");
}/*--(end setup )---*/
void loop() /*----( LOOP: RUNS CONSTANTLY )----*/
{
{
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}
}/* --(end main loop )-- */
/* ( THE END ) */
Erni 's link in his post is where I found and how I wired it
the pic I posted shows what error I keep getting when I try to upload the sketch as well
sorry for this delayed response but its been difficult to get into the forums for some odd reason.
thx arduinodlb
i updated the library and used the helloworld sketch the library came with.
it successfully uploaded but now the display backlight blinks fast and i cannot make out any characters. you can see something is scrolling across the screen but its unreadable. i have played with contrast control on the back of the board but still cant make out any letters. is there a bad connection? ive switched jumper wires but i still get the same result.
YWrobot LCM1602 IIC board are a little tricky to handle because the chinese swap some pins when they develop the board.
I also loose sometime when I bought mine and I found the pins on PCF8574 does not correspond to what was declared inside the library.
I have a board like yours and below is the fixed library to work with it.
To test this sketch you need to make sure you copy this library to arduino libraries folder(extracted off course) and make SURE you don't have nothing else there named(folders) LiquidCrystal_I2C than my library folder
The run this sketch:
override9,
I would stick with fm's library it has been highly tested.
What you are experiencing is not an issue with the library
that needs to be "fixed" but rather a misconfigured library.
The sketch tells the library which of the i2c i/o expander pins is connected to which LCD pin
by the numbers in the constructor.
You have to get his correct for your ic2 board since different i2c boards wire up the pins differently.
You will need to know how the pins from the pcf8574 are wired to the LCD module.
It isn't difficult to figure out as you can usually follow all the traces from the chip
to the LCD to come up with the pin mapping.
ive got it working finally!! thx bill and everyone for help!!
i ended up uninstalling and installing the new arduino as per the new update and also deleting my added libraries.
so i ended downloading hugopt's provided library he put on the forum.
this is awesome!!!! XD XD XD