Beaglebone Black with Adafruit

beaglebone black

I tried out the the BBB with the Adafruit python library.

I was connecting a Voltmeter to the right Pin and run the following program

 import Adafruit_BBIO.GPIO as GPIO
 import time
 pin = "P8_10"

 GPIO.setup(pin, GPIO.OUT)

 for x in range(0,5):
     print("High")
     GPIO.output(pin,GPIO.HIGH)
     time.sleep(1)
     print("Low")
     GPIO.output(pin,GPIO.LOW)
     time.sleep(1)

 GPIO.cleanup()

Unfortunalty it was always on high, I did try a 1kOhm pulldown resistor to the ground. Still the same always high.

I did try the it the other way using this code:

 import Adafruit_BBIO.GPIO as GPIO
 import time
 pin = "P8_10"

 print("Setup " + pin)


 GPIO.setup(pin, GPIO.IN)
    for x in range(0,5):
            if GPIO.input(pin):
                    print("High")
            else:
                    print("Low")
            time.sleep(0.5)

 print("end")
 GPIO.cleanup()

Connecting it over a 1kOhm resistor to ground. I did still stay High all the time.

The OS on my BBB is Ubuntu. Any suggestions what could be wrong with the setup?

Best Answer

Based on the Adafruit Learn page for the library

The majority of this library will need to be run as sudo in Ubuntu.

this Stackoverflow question, and the Github Bug closure as it is by design required to be run as sudo or root, it should be an issue of not running the script as sudo.