Using digital pins in Beaglebone Black GPIO Adafruit Python Library

in #electronicslast year

Adafruit's library gives us the basic tools to use the digital ports of the board. The GPIO class gives us functions like setup() to configure if our pins are in or out and if we need pulls up or down. This function receives two arguments: the tag of your pin and the type of pin you are using. For the type of pin, you have two options: GPIO.IN is used when your pin is an in and GPIO.OUT when you define it as an out.

With the function output(), you can define the output for your digital pin. This function can only be used on pins set up as GPIO.OUT. You need two arguments to use this function: the tag of your pin and the digital value you want to write on it. For the digital values, there are two options: GPIO.HIGH for high value and GPIO.LOW for low value.

Here, you can see the next code example, where you can check the use of the mentioned functions.

import Adafruit_BBIO.GPIO as GPIO

GPIO.setup("P9_17", GPIO.OUT)
GPIO.output("P9_17", GPIO.HIGH)
GPIO.cleanup()

This is all for this small post. I hope to keep feeding this blog with more information, along with a project I am working on.

If you find this information useful, just let me know. I will appreciate it.

You can leave any feedback in the comments section.