Last active
August 18, 2025 06:21
-
-
Save brentmc79/2fb713792e77295f9d0fa782b6f43460 to your computer and use it in GitHub Desktop.
A bash script that installs dependencies required to use the Waveshare LCD hat with a Raspberry Pi Zero
This file contains hidden or 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
| #!/bin/bash | |
| # Exit immediately if a command exits with a non-zero status. | |
| set -e | |
| # --- 1. Install bcm2835 library --- | |
| echo ">>> [1/5] Installing bcm2835 library..." | |
| wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.71.tar.gz | |
| tar zxvf bcm2835-1.71.tar.gz | |
| cd bcm2835-1.71/ | |
| sudo ./configure && sudo make && sudo make check && sudo make install | |
| cd .. # Return to the original directory | |
| echo ">>> bcm2835 library installation complete." | |
| echo | |
| # --- 2. Install WiringPi library (for pre-Bullseye OS) --- | |
| # Note: For Bullseye OS, you should use the section below instead. | |
| echo ">>> [2/5] Installing and updating WiringPi..." | |
| cd ~ # Go to home directory | |
| cd /tmp | |
| wget https://project-downloads.drogon.net/wiringpi-latest.deb | |
| sudo dpkg -i wiringpi-latest.deb | |
| #sudo apt-get install wiringpi -y | |
| # Upgrade WiringPi for systems after May 2019 | |
| echo ">>> Attempting to upgrade WiringPi..." | |
| wget https://project-downloads.drogon.net/wiringpi-latest.deb | |
| sudo dpkg -i wiringpi-latest.deb | |
| echo ">>> Checking WiringPi version (should be 2.52 for this method):" | |
| gpio -v | |
| echo | |
| # --- 3. Install WiringPi for Bullseye OS (Alternative) --- | |
| # Uncomment the following lines if you are using the Bullseye OS. | |
| # Make sure to comment out section 2 if you use this one. | |
| # echo ">>> [3/5] Building WiringPi for Bullseye OS..." | |
| # cd ~ # Go to home directory | |
| # git clone https://github.com/WiringPi/WiringPi | |
| # cd WiringPi | |
| # ./build | |
| # echo ">>> Checking WiringPi version (should be 2.70 for Bullseye):" | |
| # gpio -v | |
| # cd .. # Return to home directory | |
| # echo | |
| # --- 4. Install lg library --- | |
| echo ">>> [4/5] Installing lg library..." | |
| cd ~ # Go to home directory | |
| # The 'sudo su' command is replaced by running the necessary commands with 'sudo' | |
| wget https://github.com/joan2937/lg/archive/master.zip | |
| unzip -o master.zip # -o overwrites existing files without prompting | |
| cd lg-master | |
| sudo make install | |
| cd .. # Return to home directory | |
| echo ">>> lg library installation complete." | |
| echo | |
| # --- 5. Install Python dependencies --- | |
| echo ">>> [5/5] Installing Python dependencies..." | |
| sudo apt-get update | |
| sudo apt-get install python3-pip python3-pil python3-numpy -y | |
| sudo pip3 install spidev | |
| echo ">>> Python dependencies installation complete." | |
| echo | |
| echo "--- All installations are complete! ---" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment