Code: Select all
from Adafruit_BBIO.Encoder import RotaryEncoder, eQEP2
test_encoder = RotaryEncoder(eQEP2)
# Enable
test_encoder.enable()
# Attempt to set frequency
test_encoder.frequency = 2000
print(test_encoder.frequency)
# Disable
test_encoder.disable()
Code: Select all
debian@beaglebone:~$ python encoder_test.py
2000
debian@beaglebone:~$ python3 encoder_test.py
OSError: [Errno 22] Invalid argument
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "encoder_test.py", line 9, in <module>
test_encoder.frequency = 2000
File "/usr/local/lib/python3.5/dist-packages/Adafruit_BBIO/Encoder.py", line 355, in frequency
self._eqep.node.period = str(period)
File "/usr/local/lib/python3.5/dist-packages/Adafruit_BBIO/sysfs.py", line 93, in __setattr__
fp.write(val)
OSError: [Errno 22] Invalid argument
3.5.3
System Version Info:
Code: Select all
git:/opt/scripts/:[e9bcff232834702c1c810710706ee815d77b080b]
eeprom:[A335BNLT00C05014BBBK12CA]
model:[TI_AM335x_BeagleBone_Black]
dogtag:[BeagleBoard.org Debian Image 2018-10-07]
bootloader:[microSD-(push-button)]:[/dev/mmcblk0]:[U-Boot 2018.09-00002-gd5b4c4b656]:[location: dd MBR]
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2014.04-00014-g47880f5]:[location: fatfs /boot/uboot/MLO]
kernel:[4.14.71-ti-r80]
nodejs:[v6.15.0]
uboot_overlay_options:[enable_uboot_overlays=1]
uboot_overlay_options:[disable_uboot_overlay_video=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.20181120.0-0rcnee0~stretch+20181120]
pkg:[bb-wl18xx-firmware]:[1.20180517-0rcnee0~stretch+20180517]
pkg:[kmod]:[23-2rcnee1~stretch+20171005]
pkg:[librobotcontrol]:[1.0.4-git20181123.0-0rcnee0~stretch+20181124]
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/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 quiet]
dmesg | grep pinctrl-single
[ 1.119815] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568
dmesg | grep gpio-of-helper
[ 1.131784] gpio-of-helper ocp:cape-universal: ready
END