The easiest way to do this is probably to edit your ~/Bela_startup.sh
file.
Once you set a program on boot, ~/Bela_startup.sh
will look something like this:
#!/bin/sh
#
# This file is autogenerated by Bela. Do not edit!
echo Running Bela...
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin"
cd /root/Bela/projects/1-digital-out && screen -S Bela -d -m /root/Bela/projects/1-digital-out/1-digital-out -p16 -C8 -B16 -H-6 -N1 -G1 -M0 -D0 -A0 --pga-gain-left=10 --pga-gain-right=10 -X0
This file is executed at boot and runs your program. You could then edit it so that it runs multiple programs one after the other. You would then have to stop the currently running program which would automatically run the next one. You can use the button on the Bela cape to do this: if you tap it briefly, it will stop the currently running program.
So assuming you have the projects listed in the $PROJECTS
environmental variable already compiled and ready to go, and that you use the same command line $OPTIONS
for all of them, if you put the following in your ~/Bela_startup.sh
then you should be able to achieve what you ask by pressing the button on the Bela cape.
#!/bin/sh
OPTIONS="-p16 -C8 -B16 -H-6 -N1 -G1 -M0 -D0 -A0 --pga-gain-left=10 --pga-gain-right=10 -X0"
PROJECTS="duck basic exampleTempProject"
echo Running Bela...
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin"
screen -S Bela -d -m bash -c "\
while sleep 0.1;
do for PROJECT in $PROJECTS;
do sleep 0.3;\
echo Running \$PROJECT, press a button to load the next project;\
cd /root/Bela/projects/\$PROJECT && ./\$PROJECT $OPTIONS;\
done;\
done;"
Note that is you hold press that button for over 2seconds then the board will do a graceful shutdown. If you are concerned that this may happen inadvertently, you can disable it by editing the content of ~/Bela_capeButtonHold.sh
.