Large Font Help

Hi there, Im relatively new to arduinos/any microprocessor. I have figured out printing to lcd, reading the values of a pot etc and reading the state of 5 different switches, all things that my item needs.

Unfortunatly, the output to the lcd(16x2) is too small so I went on the hunt for code compatable with LiquidCrystal as I dont fancy changing my code now. The code I found is:

#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);

byte custchar[8][8] = {
 {
   B11111,
   B11111,
   B11111,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B11111,
   B11111,
   B11111
 }, {
   B11111,
   B11111,
   B11111,
   B00000,
   B00000,
   B11111,
   B11111,
   B11111
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B01110,
   B01110,
   B01110
 }, {
   B00000,
   B00000,
   B00000,
   B01110,
   B01110,
   B01110,
   B00000,
   B00000
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000
 }, {
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000,
   B00000
 }
};

byte bignums[10][2][3] = {
 {
   {255, 0, 255},
   {255, 1, 255}
 },{
   {0, 255, 254},
   {1, 255, 1}
 },{
   {2, 2, 255},
   {255, 1, 1}
 },{
   {0, 2, 255},
   {1, 1, 255}
 },{
   {255, 1, 255},
   {254, 254, 255}
 },{
   {255, 2, 2},
   {1, 1, 255}
 },{
   {255, 2, 2},
   {255, 1, 255}
 },{
   {0, 0, 255},
   {254, 255, 254}
 },{
   {255, 2, 255},
   {255, 1, 255}
 },{
   {255, 2, 255},
   {254, 254, 255}
 }
};

void loadchars() {
 lcd.command(64);
 for (int i = 0; i < 8; i++)
   for (int j = 0; j < 8; j++)
     lcd.write(custchar[i][j]);
 lcd.home();
}

void printbigchar(byte digit, byte col, byte row, byte symbol = 0) {
 if (digit > 9) return;
 for (int i = 0; i < 2; i++) {
   lcd.setCursor(col, row + i);
   for (int j = 0; j < 3; j++) {
     lcd.write(bignums[digit][i][j]);
   }
   lcd.write(254);
 }
 if (symbol == 1) {
   lcd.setCursor(col + 3, row + 1);
   lcd.write(3);
 } else if (symbol == 2) {
   lcd.setCursor(col + 3, row);
   lcd.write(4);
   lcd.setCursor(col + 3, row + 1);
   lcd.write(4);
 }
 
 lcd.setCursor(col + 4, row);
}

void setup() {
 pinMode(13, OUTPUT);
 loadchars();
 digitalWrite(13, 1);
 
 printbigchar(0, 0, 0);
 printbigchar(1, 4, 0);
 printbigchar(2, 8, 0);
 printbigchar(3, 12, 0);
 printbigchar(4, 16, 0, 1);
 printbigchar(5, 0, 2);
 printbigchar(6, 4, 2);
 printbigchar(7, 8, 2);
 printbigchar(8, 12, 2);
 printbigchar(9, 16, 2, 2);
}

void loop() {}

But have no idea how to implement it. Can anyone give me an example here to print out a large '1', then nI will be able to figure the rest hopefully. Just need a nudge in the right directiojn.

Thanks alot, tgw :wink:

My reading of that code is that it prints out the digits 0-9 in the "big font". The printbigchar(1, 4, 0); line toward the end of setup() is the one that prints the large "1".

What did you get when you ran that code? I may be missing something obvious here.

[edit]That code does expect to run on a 20x4 LCD, but if you comment out the last 6 printbigchar(...); lines it should run Ok on your 16x2 model.[/edit]

Hi, after commenting out the last 5-6 it worked just fine :smiley: Thank you.

Now, is there anyway of having these as the default chars used by the arduino? Im detecting which switch is pressed and would like to show the number using bigchars.

Thanks

Looks like you've been pasting in from Word and you've picked up some tags that aren't closed. Don't copy and paste from Word; it does this. It does this A LOT.

Instead, if you like to write in Word, copy it into Wordpad using Paste Special, Remove Formatting and then copy THAT and paste it. You'll need to add formatting afterwards.
OR
Use an offline blog editor like Ecto or Blogdesk.
OR
Just type straight into the Post box on the Write page.

To fix this, you'll need to edit your posts to get rid of all the extraneous tags. Edit the post and on the edit page, click the Advanced Toolbar button (farthest on the right) and that'll open the Advanced Toolbar. On the Advanced Toolbar, click the little broom icon, which cleans up your code. Do this on every post starting from the top of the blog until the problem goes away.

Hi, thanks all, managed to get it working using:

printcustchar(i, 6, 0);

It was using the variable I was having trouble with as I deleted 6, 0 when I added it.

Put it back and it compiles and works now:)

Thanks!