Re: Problem with custom chars on LCD ( SOLVED )

Hello, I have a problem with the custom characters on LCD. When I load up the code It works great and It has this appearance: http://i.imgur.com/NWeBFtb.jpg

But when I unplug it and plug in again It has this appearance : http://i.imgur.com/6DcAWbh.jpg

and I must run the code again. I use arduino nano

This is an example of my code:

#include <LiquidCrystal.h>
#include <Wire.h>
LiquidCrystal lcd(11, 10, 7, 6, 5, 4);

byte arrowL[8]={B00110, B01100, B11000, B11111, B11111, B11000, B01100, B00110}; //icon for arrowL

byte arrowR[8]={B01100, B00110, B00011, B11111, B11111, B00011, B00110, B01100}; //icon for arrowR

byte termometru[8]={B00100, B01010, B01010, B01110, B01110, B11111, B11111, B01110}; //icon for termometer

byte picatura[8]={B00100, B00100, B01010, B01010, B10001, B10001, B10001, B01110};//icon for water droplet

void setup(){
  lcd.createChar(1, termometru);
  lcd.createChar(2, picatura);
  lcd.createChar(3, arrowL);
  lcd.createChar(4, arrowR);
  lcd.begin(16, 2);
  lcd.clear();
}

void loop (){
  lcd.setCursor(0,0);
  lcd.print(char(1));
  lcd.setCursor(5,0);
  lcd.print(char(2));
  lcd.setCursor(0,1);
  lcd.print(char(3));
  lcd.setCursor(5,1);
  lcd.print(char(4));
}

When you say "I unplug it and plug in again", do you mean the entire system, or just the LCD?

You should probably initialize your LCD controller before you start using it.

Put your lcd.begin(...); statement first.

Don

Alex_Tr: Hello, When I load up the code It works great ... But when I unplug it and plug in again ... I must run the code again.

Yes, of course. Why would you expect anything different?

So, what's the problem?

LCDs do not have any non volatile memory. Power off and they forget.

Well, I fixed it.. It was the library (liquid crystal), I reinstall arduino.exe and now works great.

igendel: When you say "I unplug it and plug in again", do you mean the entire system, or just the LCD?

Seems as if we will never know.

Paul__B: Seems as if we will never know.

:D Heh, we could try to re-install this forum system, maybe the answer will come up...

igendel: :D Heh, we could try to re-install this forum system, maybe the answer will come up...

From what I understand it may also have other benefits as well ;)