Hello,
I would like to clean up my code by creating a string in the beginning and simply printing that string throughout the code. I hope that it will operate a little quicker that way and just provide some housecleaning.
Right now, I am using the following code to generate a Left/Right type bar graph that resembles a different "level".
//Creating Custom Char (5)
uint8_t bar0[8] = {
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
uint8_t bar5[8] = {
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};
void setup(){
lcd.createChar(0, bar0);
lcd.createChar(5, bar5);
}
void loop(){
If (my variable == my conditions for level3){
lcd.print("< [^]");
lcd.write(5);
lcd.write(5);
lcd.write(5);
lcd.print("> ");
level = -3;
}
This is roughly what I would like to do, but am not sure how to get that done with the string and custom character.
//Creating Custom Char (5)
uint8_t bar0[8] = {
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
uint8_t bar5[8] = {
0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F};
void setup(){
lcd.createChar(0, bar0);
lcd.createChar(5, bar5);
//Creating Levels
String level2 = "";
level2 += ("< [^]");
level2 += (5);
level2 += (5);
level2 += (" > ");
String level3 = "";
level3 += ("< [^]");
level3 += (5);
level3 += (5);
level3 += (5);
level3 += ("> ");
}
void loop(){
If (my variable == my conditions for level3){
lcd.print(level3);
}
Is that something that can be done?