Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

Custom characters on LCD screen arduino

I'm a beginner at coding and for school have to do a project wich includes an arduino and an lcd screen, In this lcd screen we need to have or emblem and a battery icon, now I'm asking for help on the first part.

Ilearned about custom characters in arduino and created 14 of them to visualize our logo for our project. Now I have tred everything but the first 3 characters on the top row arent what they are supposed to be, it's supposed to be on the top row the characters mountain1 through 7, and on the bottom row the word KEEPERS.

If there is anyone who can point me in a good direction as to why it won't work.

#include <LiquidCrystal.h>
#include <Wire.h>


LiquidCrystal lcd(8, 12, 4, 5, 6, 7);
byte Mountain1[] = {
  B00000,
  B00000,
  B00000,
  B00001,
  B00011,
  B00111,
  B01111,
  B11111,
};
 byte Mountain2[] = {
  B00000,
  B01000,
  B11100,
  B11110,
  B11111,
  B11111,
  B11111,
  B11111,
};
byte Mountain3[] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B10000,
  B11001,
  B11111,
};
byte Mountain4[] = {
  B00000,
  B00000,
  B00001,
  B00011,
  B00111,
  B11111,
  B11111,
  B11111,
};
byte Mountain5[] = {
  B00000,
  B00000,
  B10000,
  B11000,
  B11100,
  B11110,
  B11111,
  B11111,
};
byte Mountain6[] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B01000,
  B11110,
  B11111,
};
byte Mountain7[] = {
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B00000,
  B10000,
};
byte LetterK[] = {
  B11111,
  B11111,
  B10111,
  B10110,
  B10101,
  B10011,
  B10101,
  B10110,
};
byte LetterE[] = {
  B11111,
  B11111,
  B11011,
  B10101,
  B10011,
  B10111,
  B10101,
  B11011,
};
byte LetterP[] = {
  B11111,
  B11111,
  B11011,
  B10101,
  B10011,
  B10111,
  B10111,
  B10111,
};
byte LetterR[] = {
  B11111,
  B11111,
  B11011,
  B10101,
  B10111,
  B10111,
  B10111,
  B10111,
};
byte LetterS[] = {
  B11000,
  B11100,
  B10010,
  B01101,
  B10111,
  B11011,
  B01101,
  B10011,
};

String nounString = "";
String verbString = "";
int verbInt = 0;
int modus = 2;
bool stringComplete = false;
int recMode = 0; //0=nothing, 1=verb, 2=noun





void setup() {
  lcd.begin(16, 2);    
  lcd.createChar(1, Mountain1);
  lcd.createChar(2, Mountain2);
  lcd.createChar(3, Mountain3);
  lcd.createChar(4, Mountain4);
  lcd.createChar(5, Mountain5);
  lcd.createChar(6, Mountain6);
  lcd.createChar(7, Mountain7);
  
  lcd.createChar(8, LetterK);
  lcd.createChar(9, LetterE);
  lcd.createChar(10, LetterP);
  lcd.createChar(11,LetterR);
  lcd.createChar(12,LetterS);
  
  Wire.begin(4);                
  Wire.onReceive(receiveEvent); 
  Serial.begin(9600);
}

void loop() {
  
  lcd.setCursor(0, 0);
  lcd.write(byte(1));
  
  lcd.setCursor(0, 1);
  lcd.write(byte(8));
  
  lcd.setCursor(1, 0);
  lcd.write(byte(2));
  
  lcd.setCursor(1, 1);
  lcd.write(byte(9));
  
  lcd.setCursor(2, 0);
  lcd.write(byte(3));
  
  lcd.setCursor(2, 1);
  lcd.write(byte(9));
  
  lcd.setCursor(3, 0);
  lcd.write(byte(4));
  
  lcd.setCursor(3, 1);
  lcd.write(byte(10));
  
  lcd.setCursor(4, 0);
  lcd.write(byte(5));
  
  lcd.setCursor(4, 1);
  lcd.write(byte(9));
  
  lcd.setCursor(5, 0);
  lcd.write(byte(6));
  
  lcd.setCursor(5, 1);
  lcd.write(byte(11));
  
  lcd.setCursor(6, 0);
  lcd.write(byte(7));
  
  lcd.setCursor(6, 1);
  lcd.write(byte(12));
}
question from:https://stackoverflow.com/questions/65875888/custom-characters-on-lcd-screen-arduino

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...