Announcement
Collapse
No announcement yet.
help! buttons on picoreplayer88.1.0
Collapse
X
-
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
Ensure that the file survives a reboot by executing "pcp bu".
Add "/home/tc/start-sbpd.sh" in user command #1.
-
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
-
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
-
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 rbPaul 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
-
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
Comment
-
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
-
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
-
“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 rebootPaul 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
-
Can you execute the following on the command line:
Code:/bin/sh -x /home/tc/start-sbpd.sh
And also
Code:ls -al /home/tc/
Last edited by jd68; 2022-04-20, 18:13.
Comment
Comment