Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 3.48 KB

README.md

File metadata and controls

40 lines (30 loc) · 3.48 KB

gpiozero-recipes

Sample recipes of gpiozero, a simple interface to GPIO devices with Raspberry Pi.

List of recipes

Number File Name Description Wiring Circuit GPIO
1 01-LED-blinky-01.py LED blinky. 01-LED-blinky-01 --> 23
2 02-hello-button-01.py Push the button
to say hello.
02-hello-button-01 --> 24
3 03-LED-button-01.py Push the button
to turn the LED on.
03-LED-button-01 --> 23,24
4 04-PWM-LED-01.py LED brightness control with PWM, or Pulse Witdh Modulation. 04-PWM-LED-01 --> 23
5 05-servo-01.py Turn the servo moter. 05-servo-01 --> 17
6 06-light-sensor-01.py Say when it's light or dark. 06-light-sensor-01 --> 11
7 07-distance-sensor-01.py Supersonic distance sensor. 07-distance-sensor-01 --> 23,24
8 07-distance-sensor-02.py Supersonic distance sensor and 4-digit 7-segment LED display. 07-distance-sensor-02 --> 20,21,23,24
9 08-motion-sensor-01.py PIR (Passive Infrared Ray) motion sensor. 07-distance-sensor-02 --> 4
Number File Name Description Wiring Circuit GPIO

How to eat, or run the code

  1. Clone the code down to you computer.
  2. Go into the working directory.
  3. Make the circuits with circuit diagrams made with Fritzing.
  4. Run the code by Python.
  5. Enjoy coding, hacking, and tinkering!
$ cd Documents
$ cd Python\ Projects
$ git clone paste-the-URL-from-the-green-button-of-Clone-or-download
$ cd gpiozero-recipes
$ python3 01-LED-blinky.py

Change the pin factory from its default RPi.GPIO to pigpio in order to get more precise measurement with supersonic distance sensor.
$ GPIOZERO_PIN_FACTORY=pigpio python3 07-distance-sensor-01.py