Small concern found on LiquidCrystalCreateChar Reference code

Hello everyone,

I found a little something with the example code.

byte smiley[8] = {
  B00000,
  B10001,
  B00000,
  B00000,
  B10001,
  B01110,
  B00000,
};

When creating this character, the code only used 7 bytes, not 8. With beginners in mind, I would recommend adding the unneeded 8th byte "B00000" to give a clear template. Without all these bytes a beginner may not understand how to create a full character if the instructions were not completely read.

-Englishscone

Hi Englishscone. I think that is a very good suggestion. In addition to being potentially confusing, this also could lead to a confusing bug if the user made the smiley local (after all, why is it even global?). As a local variable, the uninitialized part of the array can have any values.

I notice that in the example sketch that comes with the library, the array is fully initialized (note they put the extra blank row at the top): https://github.com/arduino-libraries/LiquidCrystal/blob/master/examples/CustomCharacter/CustomCharacter.ino#L63-L72

byte smiley[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b10001,
  0b01110,
  0b00000
};

The people with access to edit the Arduino documentation aren't always able to keep up with all the posts on the forum, so there is a good chance they won't see your suggestion. The best way to bring it to their attention is to submit an issue to the bug tracker for the LiquidCrystal library: https://github.com/arduino-libraries/LiquidCrystal/issues Thanks!

pert: Hi Englishscone. I think that is a very good suggestion. In addition to being potentially confusing, this also could lead to a confusing bug if the user made the smiley local (after all, why is it even global?). As a local variable, the uninitialized part of the array can have any values.

I notice that in the example sketch that comes with the library, the array is fully initialized (note they put the extra blank row at the top): https://github.com/arduino-libraries/LiquidCrystal/blob/master/examples/CustomCharacter/CustomCharacter.ino#L63-L72

byte smiley[8] = {
  0b00000,
  0b00000,
  0b01010,
  0b00000,
  0b00000,
  0b10001,
  0b01110,
  0b00000
};

The people with access to edit the Arduino documentation aren't always able to keep up with all the posts on the forum, so there is a good chance they won't see your suggestion. The best way to bring it to their attention is to submit an issue to the bug tracker for the LiquidCrystal library: https://github.com/arduino-libraries/LiquidCrystal/issues Thanks!

Thank you so much! Wow that was my first karma, feels amazing haha.

Englishscone's issue report: https://github.com/arduino-libraries/LiquidCrystal/issues/26 Thanks very much for doing that!