Code

We will need to start off by installing two Adafruit libraries. These are the Adafruit GFX Library and the Adafruit PCD8544 Nokia 5110 LCD library. These libraries are installed as we will need to include them and the SPI library. We can do this by adding the following include statements at the beginning of the sketch:

#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

We will not want to initiate an instance of the Adafruit_PCD8544 type using the following code:

Adafruit_PCD8544 display = Adafruit_PCD8544(13, 11, 5, 4, 3);

The parameters are the Arduino pin numbers that the CLK, DIN, DC, CE and RST pins respectively are connected too.

In the setup() function, we will want to add the following code to set up the ...

Get Mastering Arduino now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.