A collection of examples for using the gpiozero library for reading sensors and activating actuators
Go to file
2020-11-26 13:59:24 +01:00
templates init commit 2020-11-18 07:48:51 +01:00
.gitignore Initial commit 2020-11-18 07:44:19 +01:00
analogSensor.py Update 'analogSensor.py' 2020-11-19 06:39:24 +01:00
distanceSensor.py init commit 2020-11-18 07:48:51 +01:00
heartbeat.py added code for the heartbeat sensor 2020-11-26 13:55:57 +01:00
ldrLed.py init commit 2020-11-18 07:48:51 +01:00
LICENSE Initial commit 2020-11-18 07:44:19 +01:00
pulsesensor.py added code for the heartbeat sensor 2020-11-26 13:55:57 +01:00
README.md added entry for heartbeat detection 2020-11-26 13:59:24 +01:00
remoteGpioFromHome.py init commit 2020-11-18 07:48:51 +01:00
remoteGpioFromPi.py Update 'remoteGpioFromPi.py' 2020-11-20 15:17:49 +01:00
servo.py init commit 2020-11-18 07:48:51 +01:00
webLed.py init commit 2020-11-18 07:48:51 +01:00

pi_gpiozero_examples

A collection of examples for using the gpiozero library for reading sensors and activating actuators

First steps

Install python3-gpiozero

$ sudo apt update && sudo apt install python3-gpiozero

All of these examples are based on the excellent documentation of the gpiozero library

analogSensor.py

How to read analog values using a MCP3008 ADC (analog to digital converter)

distanceSensor.py

Using HC-SRO4 distance sensor

Hardware required:

* 330 & 470 ohm resistors
* HC-SRO4 Distance sensor

ldrLed.py

Using an LDR to set the values of an LED, also smoothing and constraining sensor values in the process

Hardware required:

* LDR
* LED
* 330 ohm resistor

servo.py

Operate a servo

webLed.py

Turn an LED on or off based on the input from a web page

Requires flask ($ sudo apt install python3-flask)

To change the look of the HTML page, have a look at the folder template

remoteGpioFromHome.py

Interact with an LED using remote-gpio. This allows you to write python code on your own laptop but to use sensors and actuators on the Pi.

remoteGpioFromPi.py

Read buttons on different Pis in the VPN to trigger an LED.

heartbeat.py

Changed the implementation of tut RPi's Heartbeat Pulse Sensor to work with gpiozero.

Look at heartbeat.py for how to use it. pulsesensor.py is the underlying pulse detection logic.

Works in conjunction with analog heartbeat sensors and the MCP3008 ADC.