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)