This will give us a chance to work with a display and special characters. Like these:
I have code AND wiring info for you – keep scrolling.
To save you time in wiring your display, follow these steps to make a copy of your first Arduino Display Circuit and Code or click here for wiring guide:
- login to tinkercad.com
- click on circuits on the left hand menu
- find your Arduino LED Display Circuit but DON’T OPEN IT, OK?
- click on the gear icon in the top right hand corner of the thumbnail for that circuit (see image below).
- This will make a copy of your original circuit. You can modify the copy without changing the original
.
7. Click here for my tinkercad circuit – copy the code from tinkercad into your program.
Here’s sample code to get you started – copy/paste everything between the ***** (but don’t include the stars!):
************************
#include<LiquidCrystal.h>
//https://www.makerguides.com/character-lcd-arduino-tutorial/
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
/* Example sketch to create and display custom characters on character LCD with Arduino and LiquidCrystal library. For more info see www.makerguides.com */
// Make custom characters:
byte Heart[] = {
B00000,
B01010,
B11111,
B11111,
B01110,
B00100,
B00000,
B00000
};
byte Bell[] = {
B00100,
B01110,
B01110,
B01110,
B11111,
B00000,
B00100,
B00000
};
byte Alien[] = {
B11111,
B10101,
B11111,
B11111,
B01110,
B01010,
B11011,
B00000
};
byte Check[] = {
B00000,
B00001,
B00011,
B10110,
B11100,
B01000,
B00000,
B00000
};
byte Speaker[] = {
B00001,
B00011,
B01111,
B01111,
B01111,
B00011,
B00001,
B00000
};
byte Sound[] = {
B00001,
B00011,
B00101,
B01001,
B01001,
B01011,
B11011,
B11000
};
byte Skull[] = {
B00000,
B01110,
B10101,
B11011,
B01110,
B01110,
B00000,
B00000
};
byte Lock[] = {
B01110,
B10001,
B10001,
B11111,
B11011,
B11011,
B11111,
B00000
};
void setup() {
// Specify the LCD’s number of columns and rows:
lcd.begin(16, 2);
// Create a new characters:
lcd.createChar(0, Heart);
lcd.createChar(1, Bell);
lcd.createChar(2, Alien);
lcd.createChar(3, Check);
lcd.createChar(4, Speaker);
lcd.createChar(5, Sound);
lcd.createChar(6, Skull);
lcd.createChar(7, Lock);
// Clears the LCD screen:
lcd.clear();
// Print a message to the lcd:
lcd.print(“Custom Character”);
}
void loop() {
// Print all the custom characters:
lcd.setCursor(0, 1);
lcd.write(byte(0));
lcd.setCursor(2, 1);
lcd.write(byte(1));
lcd.setCursor(4, 1);
lcd.write(byte(2));
lcd.setCursor(6, 1);
lcd.write(byte(3));
lcd.setCursor(8, 1);
lcd.write(byte(4));
lcd.setCursor(10, 1);
lcd.write(byte(5));
lcd.setCursor(12, 1);
lcd.write(byte(6));
lcd.setCursor(14, 1);
lcd.write(byte(7));
}
***************************
