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
|
Microsoft Introduces Vector Abstractions Library For .NET 21/11/2024 Microsoft has announced a preview release of the Microsoft Extensions VectorData Abstractions library, which can be used to help integrate vector stores into .NET applications and libraries. |
Ursina - A Game Engine Powered by Python 08/11/2024 Ursina is a new open source game engine in which you can code any type of game in Python, be it 2-D, 3-D, an application, a visualization, you name it. |
More News
|
Comments
or email your comment to: comments@i-programmer.info