Play Pause picoreplayer gpio usb

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ShaneC80
    Junior Member
    • Jun 2021
    • 8

    #16
    Originally posted by jofland
    @chill: How did you connect your 7 preset buttons to the gpios? I have connected 2 rotary encoders, 1 infrared, so I have only 5 gpios left free. I thought about using an port extender MCP23017 but don't get it connected/routed to sbpd.
    How'd you do your buttons and rotary encoders?

    I'm new to this, but I'm going to be putting together a 'box' of sorts using PiCorePlayer, 3.5" Touch Screen, 2x rotary encoders, maybe some buttons, and outputting the DAC straight to a set of chip-amps (TDA7293s).

    Unfortunately, while I know there's ways to use the encoders and buttons via GPIO, I'm not entirely sure how to do the plugins yet.

    Ideally I'm thinking one rotary for volume and the other acting like a mouse scroll wheel to navigate menus. Pushbuttons would be hard coded to Enter (Select), Menu Back, Play/Pause, Prev/Next, and Power....I think. IF I have enough Pins

    Comment

    • Damn
      Junior Member
      • Jan 2019
      • 13

      #17
      Hi guys nice script, but I try to connect two rotary decoders...

      I added a second button and rotary section...
      Not sure how to call them correct at the end of the script.

      Here's what I got so far but I think I'm missing something, how does one add two different commands for each rotary instead of this "VOLU"

      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
              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 permiss...
      sudo modprobe uinput
      sudo chmod g+w /dev/uinput
      
      PLAYER_MAC=aa:bb:cc:dd:ee:ff
      # button 1
      SW1=24                                           # GPIO pin number
      SH1=PAUS                                         # command for SHORT press
      LO1=MUTE                                         # command for LONG press
      LMS1=500                                         # milliseconds for long press
      
      #button 2
      SW2=23                                           # GPIO pin number
      SH2=POWR                                         # command for SHORT press
      LO2=RSRT                                         # command for LONG press
      LMS2=1000                                        # milliseconds for long press
      
      # rotary 1
      ROT1=21                                          # GPIO pin number
      ROT2=20                                          # GPIO pin number
      MODE=2 # Detent mode - Assumes 1 dial click is x steps. 1=Step Mode (default)
      
      # rotary 2
      ROT3=18                                          # GPIO pin number
      ROT4=19                                          # GPIO pin number
      MOD2=2 # Detent mode - Assumes 1 dial click is x steps. 1=Step Mode (default)
      
      sbpd -v -M $PLAYER_MAC -f /home/tc/sbpd_commands.cfg \
      b,$SW1,$SH1,2,0,$LO1,$LMS1 \
      b,$SW2,$SH2,2,0,$LO2,$LMS2 \
      e,$ROT1,$ROT2,VOLU,$MODE \
      e,$ROT3,$ROT4,????,$MOD2
      could anyone give an advice how to configure the script to use VOL+/VOL- for ROT1 and ROT2 and NEXT/PREV for ROT3 and ROT4 and how the sbpd call should exactly look like?

      thanx for your help!
      Last edited by Damn; 2021-09-22, 13:16.

      Comment

      • paul-
        Senior Member
        • Jan 2013
        • 5781

        #18
        Take a look at the readme here. https://github.com/paul-1/SqueezeButtonPi-Daemon

        But the Command for encoders is TRAC
        piCorePlayer a small player for the Raspberry Pi in RAM.
        Homepage: https://www.picoreplayer.org

        Please donate if you like the piCorePlayer

        Comment

        • Damn
          Junior Member
          • Jan 2019
          • 13

          #19
          Originally posted by paul-
          Take a look at the readme here. https://github.com/paul-1/SqueezeButtonPi-Daemon

          But the Command for encoders is TRAC
          Thanks a lot that's what I was searching for I'll have a look...

          cheers,

          Dan

          Comment

          Working...