Reputation: 11
I'm using Beaglebone black Rev c. It comes with Debian and Adafruit library for GPIO. I tried a simple program to blink the 4 built in LEDs. The program doesn't blink the LEDs. I tried it with bonescript and it works. I'm logged in as the root user. Can you help me understand why the Adafruit library doesn't work.
The bonescript code is the default code provided - this works:
var b = require('bonescript');
b.pinMode('USR0', b.OUTPUT);
b.pinMode('USR1', b.OUTPUT);
b.pinMode('USR2', b.OUTPUT);
b.pinMode('USR3', b.OUTPUT);
b.digitalWrite('USR0', b.HIGH);
b.digitalWrite('USR1', b.HIGH);
b.digitalWrite('USR2', b.HIGH);
b.digitalWrite('USR3', b.HIGH);
setTimeout(restore, 2000);
Here's my Python code snippet. I'm logged in as root and the Program runs but I don't see a change in the LEDs:
import Adafruit_BBIO.GPIO as GPIO
import time
print "Start of program"
GPIO.setup ('USR0', GPIO.OUT)
GPIO.setup ('USR1', GPIO.OUT)
GPIO.setup ('USR2', GPIO.OUT)
GPIO.setup ('USR3', GPIO.OUT)
while (True):
GPIO.output ('USR0', GPIO.HIGH)
GPIO.output ('USR1', GPIO.HIGH)
GPIO.output ('USR2', GPIO.HIGH)
GPIO.output ('USR3', GPIO.HIGH)
time.sleep (1)
GPIO.output ('USR0', GPIO.LOW)
GPIO.output ('USR1', GPIO.LOW)
GPIO.output ('USR2', GPIO.LOW)
GPIO.output ('USR3', GPIO.LOW)
time.sleep (1)
Upvotes: 1
Views: 562
Reputation: 69
Hi I had posted this on adafruit forum and there is a problem in the links used for USR leds in the library. A fix has been worked upon and pull request has been made two days back.
The later versions will resolve this issue.
https://forums.adafruit.com/posting.php?mode=reply&f=49&t=51906#review
Upvotes: 0
Reputation: 731
I have not tried the Adafruit library, but I think the GPIO module is intended for the GPIO pins – pins that supports GPIO mode for external circuitry. The four built-in LEDs are not GPIO pins.
Upvotes: 1