Pi IoT In Python Using GPIO Zero - Compound Devices |
Written by Harry Fairhead & Mike James | |||||||
Monday, 07 February 2022 | |||||||
Page 3 of 3
This treats the LEDs connected to the specified pins as a bar graph. Setting a value between -1 and 1 lights up the corresponding proportion of the LEDs with negative values, working from the top of the list of pins. So: graph.value=0.5 sets the first half of the LEDs on and: graph.value=-0.5 sets the last half of the LEDs on. It is worth knowing that you can get packaged LED Bars with 10 or 20 segments. However, you need to keep in mind that allocating even as few as 10 GPIO lines to drive such a device might leave you short for other a
TrafficLights(red, amber, green, *, yellow=None, This controls a simple traffic light device by specifying the pins that the red, amber and green LEDs are connected to. You can control the lights using the red, amber, green attributes. The attribute yellow can be used as an alternative name for amber. You have to provide the code that changes the lights, e.g. green, red/amber, red and so on. You can also use PWM to vary the brightness, but it isn’t clear why you might want to do this. There are also some classes that work with off-the-shelf boards made by a number of different companies. In Chapter but not in this extract
Summary
Raspberry Pi IoT In Python Using GPIO Zero
|
Geoffrey Hinton Shares Nobel Prize For Physics 2024 08/10/2024 with John Hopfield, for "foundational discoveries and inventions that enable machine learning with artificial neural networks." |
Postgres And Kubernetes Together In Harmony 17/10/2024 Yes, they can coexist thanks to CloudNativePG, the PostgreSQL Operator for Kubernetes. Furthermore, if you want to try before you buy you can, thanks to the new learning environment, CNPG Playground. [ ... ] |
More News
|
Comments
or email your comment to: comments@i-programmer.info