Ola.
E claro que isso nunca vai funcionar porque motivo tens os pinos A0 A1 e A2 ligados aos pinos de controlo do LCD.Sabes para que servem esses pinos?
Servem para dares o endereço ao Port Expander.
Para lhe construires o endereço ligas esses pinos ao GND ou ao VCC para construires o endereço.Ve no datasheet como
Olha para a pagina 2
LiquidCrystal_I2C lcd(32,16,2); // set the LCD address to 0x20 for a 16 chars and 2 line display
Esse endereço entra aqui como primeiro parametro mas tambem aqui colocas 0x32 o que nao é correcto.
Depois tambem te faltam os Pull-ups no BUS I2C.
Quando corregires isto tudo inda resta uma possivel falha que recai sobre a lib.Existe uma versao a rodar que foi alterada pelos chinocas para umas placas que eles vendem no ebaye trocaram as macros dos pinos para lhes facilitar o desenho da placa(fizeram me perder umas horas...)
Apos trocar uns mails com o autor da lib oficial descobri que afinal eu tinha uma dessas libs instalada e ai estavam os meus problemas.O autor original Mario confirmou me tudo isto e que muitos utilizadores teem este problema.
Para quem quiser confirmar se usa a lib correta aqui fica o mail trocado comigo e com o autor original onde ele explica as diferenças da lib.
Hi Hugo,
The only way your display can work is when you are NOT using my library but
a (copy of my) library that was modified by somebody else to work with your
display.
I know a Chinese company called DFrobot who took my library and modified
(and removed my name!) it so it would work with their PCB. I guess that's
the library you are using.
I'll show you some differences between the libraries that explain why it
works with the other connections. There are other differences, but the ones
below are related to the different connections.
MY FILES
DFrobot FILES
LiquidCrystal_I2C.h
LiquidCrystal_I2C.h
#define LCD_NOBACKLIGHT 0x80
#define LCD_NOBACKLIGHT 0x00
#define En B00010000 // Enable bit
#define En B00000100 // Enable bit
#define Rw B00100000 // Read/Write bit
#define Rw B00000010 // Read/Write bit
#define Rs B01000000 // Register select bit
#define Rs B00000001 // Register select bit
LiquidCrystal_I2C.cpp
LiquidCrystal_I2C.cpp
void LiquidCrystal_I2C::send(uint8_t value, uint8_t mode) { void
LiquidCrystal_I2C::send(uint8_t value, uint8_t mode) {
uint8_t highnib=value>>4;
uint8_t highnib=value&0xf0;
uint8_t lownib=value & 0x0F;
uint8_t lownib=(value<<4)&0xf0;
write4bits((highnib)|mode);
write4bits((highnib)|mode);
write4bits((lownib)|mode);
write4bits((lownib)|mode);
}
}
Look at the library you are using. Your content of these files MUST be
different than my files otherwise your display can not work.
In fact the pin-out is not really that different, The only difference is
that I used the low nibble for data and the high nibble for control lines.
The Chinese do it the other way around. That's all. I think they choose for
that option to simplify their PCB design.
Regards,
Mario