Program to write display text on Nokia 5110 LCD
Before running any SPI based program, we need to enable the SPI pins. There is a need to load a device tree overlay related to SPI from /lib/firmware
. Run the following command as the root in the BeagleBone console:
ls /lib/firmware | grep -i SPI
This command should output something like "ADAFRUIT-SPI0-00A0.dtbo
" and "ADAFRUIT-SPI1-00A0.dtbo
" on the terminal. Then run the following command. The change string is getting echoed in the following command according to the output of the previous command.
sudo sh –c "echo ADAFRUIT-SPI0 > /sys/devices/bone_capemgr.8/slots"
Writing about all the LCD logic drivers is out of the scope of this book. Let us use the Nokia LCD Python library made by Adafruit. This library has a driver to draw text and images on the 5110 LCD. Let us install the library and its dependency module pillow
:
git clone https://github.com/adafruit/Adafruit_Nokia_LCD.git cd Adafruit_Nokia_LCD sudo python setup.py install sudo pip...