Created
March 3, 2021 12:51
-
-
Save elktros/f2df7aaaaf7903b437b71ffc5a994ee6 to your computer and use it in GitHub Desktop.
Display text on Nokia 5110 LCD using ESP8266 NodeMCU Board.
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(14, 13, 5, 15, 4); /*D5, D7, D1, D8, D2 */ | |
int contrastValue = 60; /* Default Contrast Value */ | |
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(100); | |
/* Now let us display some text */ | |
display.setTextColor(WHITE, BLACK); | |
display.setTextSize(1); | |
display.setCursor(15,1); | |
display.println("|ESP8266|"); | |
display.setCursor(15,13); | |
display.println("|NodeMCU|"); | |
//display.setTextSize(1); | |
display.setTextColor(BLACK); | |
display.setCursor(22,25); | |
display.println("|Nokia|"); | |
display.setCursor(25,37); | |
display.println("|5110|"); | |
display.display(); | |
//delay(2000); | |
} | |
void loop() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment