paul- wrote:
> A few updates.
>
> pigpio library is interesting, but I was using it sort of wrong.....here
> is a new sbpd binary, its dynamically linked now.
>
> https://dl.dropboxusercontent.com/s/745gzmr26t8ii35/sbpd
>
> Requirements:
> > > >
- pigpio.tcz - library and tools extension
- First start pigpiod with root access. This self daemonizes, and
> there are no command line options.
- Then run sbpd as you normally would, except note the change in
> encoder setup. I've added a detent mode, which will only increment
> based on a detent. (Assuming most encoders are 4 steps per physical
> detent) This really smooths out the enocder increments.
> > >
>
> >
Code:
--------------------
> >
> For rotary encoders (one, volume only):
> e,pin1,pin2,CMD[,mode]
> "e" for "Encoder"
> p1, p2: GPIO PIN numbers in BCM-notation
> CMD: Command. one of.
> VOLU for Volume
> TRAC for Prev/Next track
> mode: Optional. one of
> 0 - Detent mode - Assumes 1 dial click is 4 steps.
> 1 - Step mode (default)
>
--------------------
> >
>
Thanks Paul. Just back from a weekend away and I've been trying this
out. I installed pigpiod.tcz from the piCorePlayer repository, and I
included the command to start it as the first line of my sbpd script
that is called at boot as a User Command from the [Tweaks] page.
Then I downloaded your latest sbpd from your dropbox link, copied it
into my home directory and changed its permissions to 755 so that I
could execute it from a shell.
All the buttons work exactly as before, as does the rotary encoder when
called with mode 1.
When I call the encoder with mode 0 it's working much more uniformly,
but not exactly as I expected from your description. I was expecting a
volume increment of 4 for every click of the encoder, but instead I'm
getting an increment of 1 for every two encoder clicks. I guess my
encoder is not the same as yours. Could you perhaps allow the user to
define their encoder's number of steps per click as part of the mode 0
call?
paul- wrote:
> To your last question, the pigpio extension includes a program called
> pigs which is a command line interface to the gpio. It's a bit clunky,
> but you can set and read pins through this command.....it requires the
> pigpiod to be running.
I ended up using the methods described in your earlier link:
Code:
--------------------
# Export pin to userspace
if [ ! -e /sys/class/gpio/gpio$pin ]; then
echo "$pin" > /sys/class/gpio/export
fi
# set control pin to output mode
echo "out" > /sys/class/gpio/gpio$pin/direction
# set pin to "0" to turn fan off initially
echo "0" > /sys/class/gpio/gpio$pin/value
.
.
.
# turn fan on
echo "1" > /sys/class/gpio/gpio$pin/value
--------------------
------------------------------------------------------------------------
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