tecno4
2.4M views | +2 today
Follow
tecno4
Información asignatura tecnología
Your new post is loading...
Your new post is loading...

Popular Tags

Current selected tag: 'Libreria GPIO Zero'. Clear
Scooped by Gumersindo Fernández
Scoop.it!

Migrating from RPi.GPIO — Gpiozero 1.5.0 Documentation

Migrating from RPi.GPIO — Gpiozero 1.5.0 Documentation | tecno4 | Scoop.it

If you are familiar with the RPi.GPIO library, you will be used to writing code which deals with pinsand the state of pins. You will see from the examples in this documentation that we generally refer to things like LEDs and Buttons rather than input pins and output pins.

GPIO Zero provides classes which represent devices, so instead of having a pin number and telling it to go high, you have an LED and you tell it to turn on, and instead of having a pin number and asking if it’s high or low, you have a button and ask if it’s pressed. There is also no boilerplate code to get started — you just import the parts you need.

GPIO Zero provides many device classes, each with specific methods and properties bespoke to that device. For example, the functionality for an HC-SR04 Distance Sensor can be found in the DistanceSensor class.

As well as specific device classes, we provide base classes InputDevice and OutputDevice. One main difference between these and the equivalents in RPi.GPIO is that they are classes, not functions, which means that you initialize one to begin, and provide its pin number, but then you never need to use the pin number again, as it’s stored by the object.

GPIO Zero was originally just a layer on top of RPi.GPIO, but we later added support for various other underlying pin libraries. RPi.GPIO is currently the default pin library used. Read more about this in Changing the pin factory.

No comment yet.
Scooped by Gumersindo Fernández
Scoop.it!

GPIO in Python 

GPIO in Python  | tecno4 | Scoop.it

Using the GPIO Zero library makes it easy to get started with controlling GPIO devices with Python.

No comment yet.