Go Down

Topic: problem lcd i2c and arduino uno (Read 1 time) previous topic - next topic

Nickb84

i don't understand because this code not work with my arduino uno and a dfrobot LCD1602 I2C/TWI module. when i click on verify out the message: no matching function for call to 'LiquidCrystal::LiquidCrystal(int)

/*
Demonstration sketch for Adafruit i2c/SPI LCD backpack
using MCP23008 I2C expander
( http://www.ladyada.net/products/i2cspilcdbackpack/index.html )

This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* 5V to Arduino 5V pin
* GND to Arduino GND pin
* CLK to Analog #5
* DAT to Analog #4
*/

// include the library code:
#include "Wire.h"
#include "LiquidCrystal.h"

// Connect via i2c, default address #0 (A0-A2 not jumpered)
LiquidCrystal lcd(0);

void setup() {
  // set up the LCD's number of rows and columns:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);

  lcd.setBacklight(HIGH);
  delay(500);
  lcd.setBacklight(LOW);
  delay(500);
}

Nickb84

also this code not work. when i click verify out message: 'LiquidCrystal_I2C' does not name a type


//DFRobot.com
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

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

void setup()
{
  lcd.init();                      // initialize the lcd

  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("Hello, world!");
}

void loop()
{
}

woody_unreal

Have you found and Downloaded the LiquidCrystal_I2C.h Library ?

James C4S

The code contains a link to a complete URL:
http://www.ladyada.net/products/i2cspilcdbackpack/index.html


Read the very last section that says "Arduino Library".  Directions are there on how to download the required library and how to install it.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up