Display logo on lcd 16x2

Hello,

i want to display the Assetto Corsa logo on my lcd screen which i am planning to use as a dashboard.

Ive got this already:

#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

byte bar1[8] = 
{
        B00000,
        B00001,
        B00011,
        B00111,
        B01111,
        B11110,
        B11100,
        B11000
};

byte bar2[8] =
{
        B11110,
        B11100,
        B11000,
        B10000,
        B00000,
        B00000,
        B00000,
        B00000  
};
byte bar3 [8] =
{
        B00000,
        B00000,
        B00000,
        B00000,
        B00001,
        B00011,
        B00111,
        B01111 
};
byte bar4[8] =
{
        B00111,
        B01111,
        B11111,
        B11111,
        B11011,
        B10011,
        B00011,
        B00011
};
byte bar5[8] =
{
        B00011,
        B00011,
        B00011,
        B00010,
        B00000,
        B00000,
        B00000,
        B00000
};
byte bar6[8] =
{
        B11000,
        B10000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000,
        B00000
};
byte bar7[8] =
{
        B11000,
        B11000,
        B11000,
        B11000,
        B11000,
        B11000,
        B11000,
        B11000
};
byte bar8[8] =
{
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000
};

void setup()
{
  lcd.createChar(1,bar1);
  lcd.createChar(2,bar2);
  lcd.createChar(3,bar3);
  lcd.createChar(4,bar4);
  lcd.createChar(5,bar5);
  lcd.createChar(6,bar6);
  lcd.createChar(7,bar7);
  lcd.createChar(8,bar8);

  lcd.begin(16, 2);
  pinMode(13, OUTPUT); 
  digitalWrite(13, HIGH);
  Serial.begin(9600);
  lcd.begin(16, 2);
  lcd.print(" ");
  delay(30);
  lcd.clear ();
}

void loop()
{
  lcd.setCursor(0,1);
  lcd.write(1);
  lcd.write(2);
  lcd.write(5);
  lcd.write(6);
  lcd.setCursor(1,0);
  lcd.write(3);
  lcd.write(4);
  lcd.write(7);
}

Now my problem is when i want to assign more characters, it doesn't work?
And all the characters appear wrong?

Could some one point me in the right direction

Thanks! 8)

You could try a 2D array and create + write the characters at the same time.

Not tested, but this should give you an idea.

byte myLogo[][8]={
{ bar 1 bytes },
{ bar 2 bytes },
{ bar 3 bytes },
{ bar 4 bytes },
{ bar 5 bytes },
{ bar 6 bytes }
.
.
.
{ bar N bytes }
}

Then in the loop you can call a function that does the work for you.
void loop()
{
  lcd.setCursor(0,1);
  Logo(myLogo[1]); //lcd.write(1);
  Logo(myLogo[2]); //lcd.write(2);
  Logo(myLogo[5]); //lcd.write(5);
  Logo(myLogo[6]); //lcd.write(6);
  lcd.setCursor(1,0);
  Logo(myLogo[3]); //lcd.write(3);
  Logo(myLogo[4]); //lcd.write(4);
  Logo(myLogo[7]); //lcd.write(7);
}

void Logo(byte * data)
{
  lcd.createChar(1,data);
  lcd.write(1);
}

Could some one point me in the right direction

Have you looked here --> createChar() ?

Now my problem is when i want to assign more characters, it doesn't work?

You can't assign more than 8 characters. This is a limitation of the LCD controller, not the library.

And all the characters appear wrong?

Probably because they are numbered 0 - 7, not 1 - 8.

Don

Don, I like that. I like that a lot! :slight_smile: