Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Join Date
    Apr 2022
    Posts
    4

    help! buttons on picoreplayer8.1.0

    Name:  pcp_goio.jpg
Views: 279
Size:  36.4 KB
    Above is my button wiring diagram. Is that ok? I install picoreplayer8.1.0, LMS and pcp-sbpdtcz on raspberry pie 4B. How do I write commands in user command #1? thank you!
    Last edited by Andy Chen; 2022-04-19 at 01:28.

  2. #2
    Senior Member
    Join Date
    Jun 2009
    Posts
    151
    You should write a shell script that sets the environment and defines the buttons for SqueezeButtonPi.

    Write a text file with the following content (the last line defines the GPIOs for NEXT, PREV and PLAY):
    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 -d b,16,NEXT b,13,PLAY b,26,PREV
    Name it "start-sbpd.sh" and save it in /home/tc/.

    Ensure that the file survives a reboot by executing "pcp bu".

    Add "/home/tc/start-sbpd.sh" in user command #1.

  3. #3
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    2,632
    hi Andy Chen,

    I would research your circuit a little further.

    You would normally have resistors for each switch to limit current.

    Also, circuits often have pullup/pulldown resistors. Some of the GPIO's have these resistors installed externally, most have internal pullup/pulldown resistors that can be set with software.

    regards
    Greg

  4. #4
    Junior Member
    Join Date
    Apr 2022
    Posts
    4
    Name:  pcp2.jpg
Views: 152
Size:  210.6 KB
    Name:  pcp1.png
Views: 159
Size:  23.1 KB
    Thank you for your answers. I still can't follow the above script. Finally, I tried for a long time and finally entered it under SSH:
    sudo killall pigpiod
    sudo pigpiod -t 0 -f -l -s 10
    sudo sbpd -d b,16,NEXT,1 b,13,PLAY,1 b,26,PREV,1

    ok!

    It doesn't work on the command line of the web. I don't know why? User command #1:/home/tc/start-sbpd. Sh
    Every time you start up, you have to enter three commands in SSH. How can you add them to the startup item? thank you!

    I'm sorry, the wiring diagram above is wrong. It's 1-33, 1-36 and 1-37 physical pins, with 3.3V。

  5. #5
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    6,296
    Assuming that you have the contents of the file set correctly - including using Unix line endings (not Windows or MAC version) and you have saved the file with the correct name and in the correct place ... then you should have
    /home/tc/start-sbpd.sh
    not
    /home/tc/start-sbpd. Sh

    You might need to do a
    chmod +x start-sbpd.sh
    from SSH and then
    pcp bu

    then reboot
    pcp rb
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  6. #6
    Senior Member
    Join Date
    Jun 2009
    Posts
    151
    As Paul mentioned, you need to ensure that the script is executable.

    You can check the permissions of the script with "ls -l /home/tc/start-sbpd.sh". It should similar to this (important are the 'x'):
    Code:
    tc@SB-Kitchen:~$ ls -l /home/tc/start-sbpd.sh
    total 8
    -rwxr-xr-x    1 tc       staff         1301 Jan  4 14:48 start-sbpd.sh
    You can test the script manually on the command line of your SSH session with '/home/tc/start-sbpd.sh'.

  7. #7
    Junior Member
    Join Date
    Apr 2022
    Posts
    4
    Name:  pcp3.png
Views: 130
Size:  16.1 KB
    Name:  pcp4.png
Views: 132
Size:  10.0 KB
    Name:  pcp5.png
Views: 132
Size:  39.2 KB

    Thank you very much for your help! These problems may be very simple in your eyes. I'm not familiar with Linux. These are very strange.

    It still doesn't work according to the above settings. Is there something wrong?

  8. #8
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    6,296
    What happens if you run the script by hand from the ssh session?
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

  9. #9
    Junior Member
    Join Date
    Apr 2022
    Posts
    4
    Connection established.
    To escape to local shell, press 'Ctrl+Alt+]'.

    WARNING! The remote SSH server rejected X11 forwarding request.
    _ _____ ___ __
    ___ (_) ___/__ _______ / _ \/ /__ ___ _____ ____
    / _ \/ / /__/ _ \/ __/ -_) ___/ / _ `/ // / -_) __/
    / .__/_/\___/\___/_/ \__/_/ /_/\_,_/\_, /\__/_/
    /_/ /___/

    piCorePlayer = piCore + Squeezelite + Raspberry Pi

    The software is provided "as is" without warranty of any kind,
    either express or implied, including without limitation any implied
    warranties of condition, uninterrupted use, merchantability,
    fitness for a particular purpose, or non-infringement.
    tc@pCP:~$ /home/tc/start-sbpd.sh
    -sh: /home/tc/start-sbpd.sh: not found
    tc@pCP:~$ sudo /home/tc/start-sbpd.sh
    tc@pCP:~$

  10. #10
    Senior Member
    Join Date
    Apr 2005
    Location
    UK/London
    Posts
    6,296
    ôNot foundö implies a file permissions problem (given that the sudo worked).

    ls -lrt *.sh

    Also ů try putting
    /bin/sh
    (With a space at the end)
    at the start of your pCP User Command and reboot
    Paul Webster
    Author of "Now Playing" plugins covering Radio France (FIP etc), PlanetRadio (Bauer - Kiss, Absolute, Scala, JazzFM etc), KCRW, ABC Australia and CBC/Radio-Canada
    and, via the extra "Radio Now Playing" plugin lots more - see https://forums.slimdevices.com/showt...Playing-plugin

Posting Permissions

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