Created
February 27, 2021 08:44
-
-
Save elktros/f64877fdb71f15101845c99007ca4b26 to your computer and use it in GitHub Desktop.
Displaying simple text on Nokia 5110 LCD using ESP32.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SPI.h> | |
#include <Adafruit_GFX.h> | |
#include <Adafruit_PCD8544.h> | |
/* Declare LCD object for SPI | |
Adafruit_PCD8544(CLK,DIN,D/C,CE,RST); */ | |
Adafruit_PCD8544 display = Adafruit_PCD8544(18, 23, 4, 15, 2); | |
int contrastValue = 60; // Default Contrast Value | |
const int adcPin = 34; | |
int adcValue = 0; | |
void setup() | |
{ | |
/* Initialize the Display*/ | |
display.begin(); | |
/* Change the contrast using the following API*/ | |
display.setContrast(contrastValue); | |
/* Clear the buffer */ | |
display.clearDisplay(); | |
display.display(); | |
delay(1000); | |
/* Now let us display some text */ | |
display.setTextColor(WHITE, BLACK); | |
display.setCursor(0,1); | |
display.setTextSize(2); | |
display.println("|ESP32|"); | |
display.setTextSize(1); | |
display.setTextColor(BLACK); | |
display.setCursor(22,20); | |
display.println("|Nokia|"); | |
display.setCursor(22,32); | |
display.println("|5110|"); | |
display.display(); | |
delay(2000); | |
} | |
void loop() | |
{ | |
/* You can implement your own display logic here*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment