Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char batteryFonts [10][5]={
- { 0, 1, 1, 2 }, // you see { this "0", 1, 1, 2 }, is a problem I think
- { 3, 1, 1, 2 },
- {etc}, }
- lcd.print( batteryFonts[0]); // this sentence does not work !!!
- "char batteryFonts [10][5]={{ 4, 1, 1, 2 }, // 4 or what ever you want
- {etc},
- {etc}, }
- lcd.print( batteryFonts[0]); // this sentence behind does work !!! but only with a row that starts not with a 0 WHY ??? can u tell me please ?
- //This is a simple program that charges alkaline batteries
- //Copyleft
- #include <LiquidCrystal.h>
- // initialize the library with the numbers of the interface pins
- LiquidCrystal lcd(12, 13, 7, 4, 3, 2); // why pin 13 and not 12 ? because I love the led attached to it <3
- // the empty battery - end
- byte customLcdfont_A [8] = { // B stand for "Binary" and then the pixel ...
- B01111,
- B11000,
- B10101,
- B10100,
- B10100,
- B10100,
- B11000,
- B01111
- // the empty battery body with fancy graphics enabled
- };
- byte customLcdfont_B [8] = { // B stand for "Binary" and then the pixel ...
- B11111,
- B00000,
- B11001,
- B00000,
- B00000,
- B00000,
- B00000,
- B11111
- };
- // the empty battery + end
- byte customLcdfont_C [8] = { // B stand for "Binary" and then the pixel ...
- B11100,
- B00100,
- B10111,
- B00101,
- B00111,
- B00111,
- B00100,
- B11100
- };
- // the full battery - end
- byte customLcdfont_D [8] = { // B stand for "Binary" and then the pixel ...
- B1111,
- B11111,
- B10110,
- B10111,
- B10111,
- B10111,
- B11111,
- B1111
- };
- // the FULL battery + end
- byte customLcdfont_E [8] = { // B stand for "Binary" and then the pixel ...
- B11100,
- B11100,
- B01111,
- B11101,
- B11111,
- B11111,
- B11100,
- B11100
- };
- // the full battery body
- byte customLcdfont_F [8] = {
- B11111,
- B11111,
- B00110,
- B11111,
- B11111,
- B11111,
- B11111,
- B11111
- };
- // the 1/3 battery body
- byte customLcdfont_G [8] = {
- B11111,
- B11000,
- B00001,
- B11000,
- B11000,
- B11000,
- B11000,
- B11111
- };
- // the 2/3 battery body
- byte customLcdfont_H [8] = {
- B11111,
- B11110,
- B00111,
- B11110,
- B11110,
- B11110,
- B11110,
- B11111
- };
- /**************************************************************************/
- void setup() {
- int i = 0 ;
- // initialize serial communications at 9600 bps:
- lcd.createChar(0, customLcdfont_A);
- lcd.createChar(1, customLcdfont_B);
- lcd.createChar(2, customLcdfont_C);
- lcd.createChar(3, customLcdfont_D);
- lcd.createChar(4, customLcdfont_E);
- lcd.createChar(5, customLcdfont_F);
- lcd.createChar(6, customLcdfont_G);
- lcd.createChar(7, customLcdfont_H);
- lcd.begin(16, 2);
- // WATCH HERE IS THE PROBLEM !!!!
- //the char table behind creates my different battery states as shown in the video ;)
- char batteryFonts [10][5]={
- { 0, 1, 1, 2 }, // this is an empty one f%*# this does not work !!!
- { 3, 1, 1, 2 },
- { 3, 6, 1, 2 },
- { 3, 7, 1, 2 },// this is a 50 % full charged battery !
- { 3, 5, 1, 2 },
- { 3, 5, 6, 2 },
- { 3, 5, 7, 2 },
- { 3, 5, 5, 2 },
- { 3, 5, 5, 4 },// this is nice full one
- };
- // this sentence behind does not work !!! but only with the raw [0]
- lcd.print( batteryFonts[0]); // I F***ing want this to display the first raw !!!!
- lcd.setCursor(0,1 );
- lcd.print(" not working ");
- lcd.setCursor(0,0 );
- delay(9300); // this make a short pause for us so that we can see the result
- lcd.setCursor(0,1 );
- lcd.print(" working ");
- lcd.setCursor(0,0 );
- for (i=0; i=10 ; i+=1 ){
- delay(300);
- lcd.setCursor(6,0 );
- lcd.write(byte(0)); lcd.write(byte(1)); lcd.write(byte(1)); lcd.write(byte(2));
- delay(700); // batterry 0/8 empty aka discharged
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(1)); lcd.write(byte(1)); lcd.write(byte(2));
- delay(1000); //batterry 1 /8
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(6)); lcd.write(byte(1)); lcd.write(byte(2));
- delay(1000);//batterry 2 /8
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(7)); lcd.write(byte(1)); lcd.write(byte(2)); //batery 3 /8
- delay(1000);
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(5)); lcd.write(byte(1)); lcd.write(byte(2));
- delay(1000); //batery 4 /8
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(5)); lcd.write(byte(6)); lcd.write(byte(2));
- delay(1000); //batery 5 /8
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(5)); lcd.write(byte(7)); lcd.write(byte(2));
- delay(1000); //batery 6 /8
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(5)); lcd.write(byte(5)); lcd.write(byte(2));
- delay(1000); //batery 7 /8
- lcd.setCursor(6,0 );
- lcd.write(byte(3)); lcd.write(byte(5)); lcd.write(byte(5)); lcd.write(byte(4)); //batery 8 /8
- delay(1000);
- }
- lcd.setCursor(15, 1);
- delay(115000);
- }
- /**************************************************************************/
- void loop() {
- //This is not interesting here
- lcd.print(" ~ The end of the code ... thank you for reading ;) ~ ");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement