Ben Nuttall over at Raspberry Pi has announced the release of GPIO Zero 1.5. This is a significant release and includes several enhancements.
- Improvements to the
DistanceSensorclass giving more accurate and reliable readings.
- Improvements to the source/value functionality meaning you could just do:
led.source = buttonto have a button activate an LED.
- Improvements to the pinout command so you can pass the -x or –xyz argument to show the pinout.xyz website in your browser.
- Support for more boards, including Jam HAT, PumpkinPi, PiHutXmasTree and TonalBuzzer classes.
- Better handling of accidents.
- Support for physical pins. This is something several of us have championed for a while. It’s not perfect but it does solve the problem in terms of specifying pins for inputs and outputs. To use physical pin numbering, just use the
BOARDprefix when defining pin usage. For example, instead of
led = LED(17), you would do
led = LED('BOARD11'). Note the quotes round the BOARD declaration – they’re important! There is also support for the WiringPi way of numbering – use the prefix WP.
This is very welcome, so thanks Ben and Dave for listening to the community! 🙂
You can upgrade to the latest version by putting the following commands into a Terminal on your Raspberry Pi:
sudo apt update sudo apt install python3-gpiozero python-gpiozero
If you still haven’t started to use GPIO Zero and want to see what the differences are between RPi.GPIO and this newer, easier-to-use library, take a look here.