Running projects on boot

By default, when you power up a Bela system it boots up and waits for you to run a program (for example, by opening the IDE and clicking the Run button). But there are times when you may want a Bela system to start running a specific project when it boots up, such as when your board is embedded in a specific instrument or installation.

This article explains how to set a project to run on boot using the IDE, and using the

Table of contents

  1. Setting a project to run on boot: IDE
    1. 1. Access the Bela IDE
    2. 2. Select a project to run on boot.
  2. Important notes when running on boot
  3. Setting a project to run on boot: Using a script
  4. Looping through projects without the IDE

Setting a project to run on boot: IDE

1. Access the Bela IDE

Connect your Bela system to your computer with a USB cable. When it’s booted up, access the IDE via http://bela.local in a browser.

2. Select a project to run on boot.

Open the Settings tab. At the very top there is a drop down menu labelled Run project on boot. Select your desired project from the dropdown menu.

Next time your board boots up it will automatically start running the project that you selected.

Important notes when running on boot

  • Any options for the program (e.g. block size or headphone gain) need to be set before setting the program to run on boot.
  • If you have a project set to run on boot then the IDE may take longer to show up when you first connect the board to a computer. To stop this simply go to the menu and select none.
  • If the program that runs on boot takes up a significant amount of CPU, it may take very long for the IDE to come up while the program is running. For this reason it may be useful to either make the Bela button accessible from the outside, or remote the corresponding pin (P9.27 on Bela, P2.34 for BelaMini) to the case with some wires. Connecting this pin to ground will stop the running program.

Setting a project to run on boot: Using a script

Bela ships with a script that you can run that will set a project to run on boot. Read about how to use it here.

Looping through projects without the IDE

If you would like to switch between projects without using the IDE then there is a simple solution which is ideal for situations where you have your Bela embedded in an instrument.

Open the Settings tab. At the very top there is a drop down menu labelled Run project on boot. Select loop_*. This will run all the projects whose name starts with loop_ in alphabetical order. If you would like your project to be run as part of the loop then rename it accordingly.

In order to switch from one project to the next you will need to stop the current project from running (the equivalent of hitting the Stop button in the IDE). The easiest way to do this without the IDE is to briefly press (for less than 2 seconds) the button on the Bela cape. If you are going to put the board in some sort of enclosure then you can extend out that button by connecting a button to P9.27 on Bela, or P2.34 on Bela Mini. It is necessary to short that pin to ground in order to move onto the next project.