I'm trying to set up a couple inputs to have pull-ups enabled, but this seems to spit out the following error:
Code: Select all
debian@beaglebone:/home/Python_Files$ sudo python fanTest.py
Traceback (most recent call last):
File "fanTest.py", line 11, in <module>
GPIO.setup(DISP_DOWN,GPIO.IN,pull_up_down=GPIO.PUD_UP)
ValueError: Set gpio mode failed, missing file or invalid permissions.
Code: Select all
sudo /opt/scripts/tools/version.sh
Code: Select all
dmesg | grep bone
Code: Select all
debian@beaglebone:/$ sudo /opt/scripts/tools/version.sh
git:/opt/scripts/:[bcfc0750f1851ba2d2809b3fdaa13ccea688f25e]
eeprom:[A335BNLT00C02818BBBK0B50]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.09-00002-g0b54a51eee]:[location: dd MBR]
kernel:[4.14.71-ti-r80]
nodejs:[v6.14.4]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo]
uboot_overlay_options:[enable_uboot_cape_universal=1]
pkg check: to individually upgrade run: [sudo apt install --only-upgrade <pkg>]
pkg:[bb-cape-overlays]:[4.4.20180928.0-0rcnee0~stretch+20180928]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.3-git20181005.0-0rcnee0~stretch+20181005]
pkg:[firmware-ti-connectivity]:[20170823-1rcnee1~stretch+20180328]
groups:[debian : debian adm kmem dialout cdrom floppy audio dip video plugdev users systemd-journal i2c bluetooth netdev cloud9ide gpio pwm eqep admin spi tisdk weston-launch xenomai]
cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.102871] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.114701] gpio-of-helper ocp:cape-universal: ready
END
Code: Select all
debian@beaglebone:/home/Python_Files$ dmesg | grep bone
[ 0.000000] Kernel command line: console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk1p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet
[ 26.896995] systemd[1]: Set hostname to <beaglebone>.
debian@beaglebone:/home/Python_Files$
Code: Select all
import Adafruit_BBIO.GPIO as GPIO
import Adafruit_BBIO.PWM as PWM
from time import sleep
DISP_UP="P9_42"
DISP_DOWN="P9_25"
DISP_LEFT="P8_26"
DISP_RIGHT="P9_41"
DISP_ENTER="P9_27"
FAN_DRV="P8_19"
GPIO.setup(DISP_UP,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(DISP_DOWN,GPIO.IN,pull_up_down=GPIO.PUD_UP)
PWM.start(FAN_DRV,0,25000)
while(1):
if GPIO.wait_for_edge(DISP_UP,GPIO.FALLING):
PWM.set_duty_cycle(FAN_DRV,35)
if GPIO.wait_for_edge(DISP_DOWN,GPIO.FALLING):
PWM.set_duty_cycle(FAN_DRV,0)
if GPIO.wait_for_edge(DISP_UP,GPIO.FALLING) and GPIO.wait_for_edge(DISP_DOWN,GPIO.FALLING):
break
sleep(0.2)
GPIO.cleanup()
PWM.stop(FAN_DRV)
PWM.cleanup()
Thanks!