Buenas pues si, es 16,2 ya lo he probado con el mismo resultado. Esa es la ultima configuración que probé pero como bien dices tu, también probé con 16,2. He probado varias librerías y demás, pero agradecería que me pasaras las tuyas y el cod que uses y si me puedes indicar k versión usas yo estoy con la 1.0.1.
Gracias a ver si entre todos podemos hacer funcionar esto k empieza a ser un poco ...
#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);
void setup()
{
lcd.begin (20,4);
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
// Position cursor and write some text
lcd.home (); // go to the first line, first character
lcd.print("SainSmart I2C tester");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print("It's Working!");
lcd.setCursor ( 0, 2 ); // go to the third line
lcd.print("Sainsmarts docs suck");
lcd.setCursor ( 0, 3 ); // go to the fourth line
lcd.print("Nice LCD Though. ");
}
void loop()
{
}
Por otro lado, como te comentan, necesitas conocer la dirección I2C del dispositivo, si no funciona cambia 0x3F por el valor que te de el siguiente programa:
// --------------------------------------
// i2c_scanner
//
// This program (or code that looks like it)
// can be found in many places.
// For example on the Arduino.cc forum.
// The original author is not know.
//
// This sketch tests the standard 7-bit addresses
// from 0 to 127. Devices with higher bit address
// might not be seen properly.
//
// Adapted to be as simple as possible by Arduino.cc user Krodal
//
// June 2012
// Using Arduino 1.0.1
//
#include <Wire.h>
void setup()
{
Wire.begin();
Serial.begin(9600);
Serial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 0; address <= 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknow error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(8000); // wait 8 seconds for next scan
}
Buenas Fm antes de nada darte las gracias por tomarte las molestias.
Prueba con la libreria del compañero Sergegsx el mismo resultado, ya he llegado a pensar que hay algo roto, pues no hace ni muestra nada mas que los cuadros (lo mismo que cuando se le da alimentacion y sin nada mas).
Despues lo del compañero fm: He bajado las librerias y leido como instalarlas (he tenido que quitar todo lo que tenia de pasados intentos, librerias y demas cosas) He paso el test y no me mostraba nada el monitor serial, pero cuando lo he mirado con el Hyperterminal me salia esto:
Scanning...
I2C device found at address 0x3F !
done
Raro verdad, segun el fabricante era 0x27 (pues NO y NO) despues he puesto el codigo primero de ejemplo y .... FUNCIONA .....
FM eres un mostro. Muchas gracias .
He comentado todo los pasos por si algun compañero pasa por el mismo tortuoso camino. Gracias a todos.
Muy buenas , estoy empazando con este tema y tengo el mismo problema que se describe en el post , pero no consigo solucionarlo.
Este es el error que me da al compilar vuestra solucion :
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.5-r2 (Windows 7), Board: "Arduino Mega 2560 or Mega ADK"
LiquidCrystal_I2C\LiquidCrystal_I2C.cpp.o: In function LiquidCrystal_I2C::pulseEnable(unsigned char)': C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.cpp:247: multiple definition of LiquidCrystal_I2C::pulseEnable(unsigned char)'
LiquidCrystal\LiquidCrystal_I2C.cpp.o:C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.cpp:287: first defined here
c:/arduino-1.0.5/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
LiquidCrystal_I2C\LiquidCrystal_I2C.cpp.o: In function LiquidCrystal_I2C::send(unsigned char, unsigned char)': C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.cpp:229: multiple definition of LiquidCrystal_I2C::send(unsigned char, unsigned char)'
LiquidCrystal\LiquidCrystal_I2C.cpp.o:C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.cpp:240: first defined here
LiquidCrystal_I2C\LiquidCrystal_I2C.cpp.o: In function LiquidCrystal_I2C::setBacklight(unsigned char)': C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.cpp:278: multiple definition of LiquidCrystal_I2C::setBacklight(unsigned char)'
LiquidCrystal\LiquidCrystal_I2C.cpp.o:C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.cpp:167: first defined here
LiquidCrystal_I2C\LiquidCrystal_I2C.cpp.o: In function LiquidCrystal_I2C::begin(unsigned char, unsigned char, unsigned char)': C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.cpp:47: multiple definition of LiquidCrystal_I2C::begin(unsigned char, unsigned char, unsigned char)'
LiquidCrystal\LiquidCrystal_I2C.cpp.o:C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.cpp:144: first defined here
LiquidCrystal_I2C\LiquidCrystal_I2C.cpp.o: In function LiquidCrystal_I2C::init()': C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.cpp:36: multiple definition of LiquidCrystal_I2C::init()'
LiquidCrystal\LiquidCrystal_I2C.cpp.o:C:\Users\Dragun\Documents\Arduino\libraries\LiquidCrystal/LiquidCrystal_I2C.cpp:194: first defined here
Simplemente borra la librería LiquidCrystal que viene en el entorno Arduino y pon es su lugar la New LiquidCrystal. Si tienes cualquier otra librería para controlar un LCD también deberías borrarla.
La New LiquidCrystal es un súper conjunto de estas librerías y mucho mas rápida.
Por ultimo, lee el manual de la wiki de la librería.
He borrado las bibliotecas de LiquidCrystal y las que se parecian , la de _I2c y la de _Fast y puesto en su lugar la que me decias "New LiquidCrystal" .
E cargado el codigo que hay mas arriba
#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);
void setup()
{
lcd.begin (20,4);
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
// Position cursor and write some text
lcd.home (); // go to the first line, first character
lcd.print("SainSmart I2C tester");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print("It's Working!");
lcd.setCursor ( 0, 2 ); // go to the third line
lcd.print("Sainsmarts docs suck");
lcd.setCursor ( 0, 3 ); // go to the fourth line
lcd.print("Nice LCD Though. ");
}
void loop()
{
}
Ya no tengo errores pero no me hace nada el LCD mas que estar encendido
Uff, soy el mas novato del mundo, me podias como defino esas entradas? Estoy usando una mega .Por lo menos que vea el hola mundo seria un gran avance para mi.
He confirmado el puerto por que el trabaja mi I2C el 0x27 y no el 0x3F , y lo e cambiado por "#define I2C_ADDR 0x27" en el scketch , Para aprender a usar el scanner e encontrado esto Arduino Playground - I2cScanner .Tambien he cambiado tipo de LCD que uso yo en la linea de " lcd.begin (16,2);" .
El scketh a quedado asi:
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27 // 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);
void setup()
{
lcd.begin (16,2);
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
// Position cursor and write some text
lcd.home (); // go to the first line, first character
lcd.print("SainSmart I2C tester");
lcd.setCursor ( 0, 1 ); // go to the 2nd line
lcd.print("It's Working!");
lcd.setCursor ( 0, 2 ); // go to the third line
lcd.print("Sainsmarts docs suck");
lcd.setCursor ( 0, 3 ); // go to the fourth line
lcd.print("Nice LCD Though. ");
}
void loop()
{
}
Y todo funcionando . Muchas gracias por la ayuda y por las pistas que han echo que me ponga a buscar y probar , y el resultado a sido un lujo .
Ahora toca buscar alguna practica, del tipo, como hacer q aparezca en lcd el tiempo que lleva encendido el lcd o algo asi.Alguna referencia de algun blog o web?
Gracias a ti FM por tu paciencia, como poco te has ganado un punto de karma , otra vez gracias
+Dragun, pues no sabría decirte. Puedes inventarte un proyecto para el LCD. No se, algo que te mida la temperatura y te de el tiempo que lleva encendido.