Home of the Squeezebox™ & Transporter® network music players.
Page 24 of 24 FirstFirst ... 14222324
Results 231 to 237 of 237
  1. #231
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,111
    Could this be related?

  2. #232
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,097
    There is a command line utility, but that works using an extra daemon running. You can read and set pins directly from a shell, there is no need for external commands.

    https://raspberrypi-aa.github.io/session2/bash.html
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  3. #233
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,111
    Quote Originally Posted by paul- View Post
    You can read and set pins directly from a shell, there is no need for external commands.

    https://raspberrypi-aa.github.io/session2/bash.html
    Perfect, thank you.

  4. #234
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,097
    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/...r26t8ii35/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)

    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.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  5. #235
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,111
    Quote Originally Posted by paul- View Post
    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/...r26t8ii35/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?

    Quote Originally Posted by paul- View Post
    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

  6. #236
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    2,097
    Likely a different encoder. Iĺll make it so you put a number in there that will define the steps......

    Iĺm busy at work this week, so it might take till next weekend.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  7. #237
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Posts
    1,111
    No rush at all on my part - both modes work, so we're only talking about tweaking the user experience here. My encoder is a Keyes KY-040.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •