3/Other Operating Systems and Linux Distributions. .............................................49
Distributions for Home Theater .....................................................................................50
Distributions for Music ...................................................................................................52
Retro Computing and Retro Gaming .............................................................................53
Internet of Things ............................................................................................................53
Other Useful Distributions ..............................................................................................54
Going Further ...................................................................................................................55
4/Python on the Pi ........................................................................................................57
Hello, Python....................................................................................................................58
A Bit More Python ...........................................................................................................60
Objects and Modules ......................................................................................................63
Even More Modules .........................................................................................................67
Launching Other Programs from Python ......................................................................70
Troubleshooting Errors ...................................................................................................72
Going Further ...................................................................................................................73
5/Arduino and the Pi ....................................................................................................75
Installing Arduino on the Raspberry Pi OS ....................................................................78
Finding the Serial Port .............................................................................................79
Talking in Serial ................................................................................................................80
Using Firmata ..................................................................................................................84
Going Further ...................................................................................................................86
6/Basic Input and Output. ............................................................................................87
Using Inputs and Outputs ...............................................................................................90
Digital Output: Lighting Up an LED .........................................................................92
Digital Input: Reading a Button ...............................................................................97
Project: Cron Lamp Timer ............................................................................................100
Scripting Commands .............................................................................................100
Connecting a Lamp ................................................................................................102
Scheduling Commands with Cron ........................................................................103
Going Further .................................................................................................................106
7/Programming Inputs and Outputs with Python .................................................107
Installation .....................................................................................................................107
Testing GPIO in Python .................................................................................................109
Blinking an LED .............................................................................................................110
Reading a Button ...........................................................................................................112
Project: Simple Soundboard ........................................................................................114
Going Further .................................................................................................................119
Contents v
GSW_RASPI_4ED_FIN.indd 5GSW_RASPI_4ED_FIN.indd 5 10/28/21 10:53 AM10/28/21 10:53 AM