Go Down

Topic: battery symbol for 20x4 hitachi lcd (Read 883 times) previous topic - next topic

overclock

Hi everyone,
  Has anyone made a small battery symbol using one character space, it would be awesome someone could show me what to do XD

   Cheers, Neo

overclock

#1
Feb 24, 2012, 02:47 am Last Edit: Feb 24, 2012, 03:19 am by overclock Reason: 1
I have a call of overloaded 'write(int)' is ambiguous

Code: [Select]
#include <LiquidCrystal.h>

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

byte battery[8] = {
  B01110,
  B10001,
  B11001,
  B10101,
  B10011,
  B10001,
  B11111,
};

void setup() {
  lcd.createChar(0, battery);
  lcd.begin(16, 2); 
  lcd.write(0);
}

void loop() {}


overclock

#2
Feb 24, 2012, 03:28 am Last Edit: Feb 24, 2012, 04:07 am by overclock Reason: 1
what am i doing wrong?


ok so i found the fix, the example has not been updated to 1.0

the line where you print the character needs to read
Code: [Select]
lcd.print((char)0);
Not
lcd.write(0);


that will solve the problem

liudr

Refer to bullet point 1 for reason of the write problem:

http://liudr.wordpress.com/2011/12/26/how-to-update-codes-and-libraries-for-arduino-1-0/

Caught me with LCD custom characters too and I dug deep into the library codes to summarize the problem into one bullet point  XD

Go Up