jemhayward wrote:
>
> Are there any diagnostics I can do to make sure the script has
> successfully run, and anything I can use to 'detect' my encoder on those
> pins in case the encoder is broken?
Yes - don't run your script from the User commands section of pCP, but
start it manually, and include the -v option in the sbpd command line.
This will allow you to see whenever sbpd reacts to a button press or an
encoder event.
While working on the Pirate Audio setup, there were some useful
suggestions for improving this button script, in particular to make sure
that the pigpio daemon really has had time to initialise before sbpd is
run (the original 'sleep 1' may not have been enough in some cases).
The result of those suggestions is this code, which waits up to 10
seconds for the daemon to start:
Code:
--------------------
#!/bin/sh
# start pigpiod daemon
pigpiod -t 0 -f -l -s 10
# wait for pigpiod to initialize - indicated by 'pigs t' exit code of zero
count=10 # approx time limit in seconds
while ! pigs t >/dev/null 2>&1 ; do
if [ $((count--)) -le 0 ]; then
printf "\npigpiod failed to initialize within time limit\n"
exit 1 # or however you want to deal with failure
fi
# printf "\nWaiting for pigpiod to initialize\n"
sleep 1
done
printf "\npigpiod is running\n"
# load uinput module - required to be able to send keystrokes
# then set the permission to group writable, so you don't need to run sbpd
with root permissions
sudo modprobe uinput
sudo chmod g+w /dev/uinput
# issue the sbpd command
sbpd ....... *<= your command string here*
--------------------
------------------------------------------------------------------------
chill's Profile: http://forums.slimdevices.com/member.php?userid=10839
View this thread: http://forums.slimdevices.com/showthread.php?t=107001
_______________________________________________
diy mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/diy