Announcement

Collapse
No announcement yet.

help! buttons on picoreplayer88.1.0

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    help! buttons on picoreplayer88.1.0

    Click image for larger version

Name:	pcp_goio.jpg
Views:	1
Size:	36.4 KB
ID:	1579008
    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, 09:28.

    #2
    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.

    Comment


      #3
      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

      Comment


        #4
        Click image for larger version

Name:	pcp2.jpg
Views:	1
Size:	210.6 KB
ID:	1574953
        Click image for larger version

Name:	pcp1.png
Views:	1
Size:	23.1 KB
ID:	1574954
        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。

        Comment


          #5
          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

          Comment


            #6
            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:
            [email protected]:~$ 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'.

            Comment


              #7
              Click image for larger version

Name:	pcp3.png
Views:	1
Size:	16.1 KB
ID:	1574960
              Click image for larger version

Name:	pcp4.png
Views:	1
Size:	10.0 KB
ID:	1574961
              Click image for larger version

Name:	pcp5.png
Views:	1
Size:	39.2 KB
ID:	1574962

              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?

              Comment


                #8
                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

                Comment


                  #9
                  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.
                  [email protected]:~$ /home/tc/start-sbpd.sh
                  -sh: /home/tc/start-sbpd.sh: not found
                  [email protected]:~$ sudo /home/tc/start-sbpd.sh
                  [email protected]:~$

                  Comment


                    #10
                    “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

                    Comment


                      #11
                      Can you execute the following on the command line:

                      Code:
                      /bin/sh -x /home/tc/start-sbpd.sh
                      Maybe that helps to see what is "not found" (if it is a command in the script and not the script itself).

                      And also

                      Code:
                      ls -al /home/tc/
                      to check the permissions of the directory.
                      Last edited by jd68; 2022-04-20, 18:13.

                      Comment

                      Working...
                      X