Nav

How to run Pi Cap script at start-up

Learn how to the run Pi Cap script at start-up

When you develop a script for the Pi Cap you might want to run it as soon as you connect your Pi to power. This way you can light a status LED at launch, or set-up the Pi Cap directly as a piano. In this tutorial, we SSH into the Pi, you can also do this set-up with a screen, mouse and keyboard.

Find out how to use the LED on the Pi Cap

How to use the LED on the Pi Cap

Explore the Pi Cap's features: Check out the audio output as well as the status LED

Pi Cap Features

Set the Pi Cap either as a touch or proximity sensor

How to make a proximity sensor with your Pi Cap

Step 1

Setting up your Pi Cap with a Pi

If you haven’t set up your Pi Cap then make sure to complete one of our set up tutorials first:

Setting up your Pi Cap on the Raspberry Pi 1, 2 or 3

Setting up your Pi Cap on the Raspberry Pi Zero

In this tutorial, we are using the network connection to work with the Pi Cap. If you are using a screen with your Raspberry Pi, all the steps here will also apply that method.

Links

Step 2

Decide which code you want to run

The first step is to decide which code you want to run on start-up. This could be, for example, one of the button example scripts. In this tutorial, we are using the “spinning LED” script. The code you choose needs to be something that runs independently. So, for example, any code that depends on writing to the terminal window isn’t suitable for running at start-up. Any code that uses the button, the LED or the capacitive sensors of the Pi Cap is more suitable.

Links

Step 3

SSH into the Pi

For this example, we are using the picap-colour-spin.cpp sketch, but you can use any of our examples sketches.

Once you have SSH’d into the Pi, enter “sudo nano /etc/rc.local” into the Terminal window and hit enter. At the bottom of the file, add “bash /home/pi/PiCapExamples/cpp/picap-colour-spin-cpp/run &” in-between “fi” and “exit 0”. If you now press CTRL + X, then Y, then enter, it will save the recent edits in the file.

Links

Step 4

Give it a try

If you now reboot the Pi, the LED should change colour!

Let us know if you have any questions or if you found another method to run your Pi Cap script at launch. You can send us an email at info@bareconductive or contact us via Instagram or Twitter.

Links

Suggested Tutorials

Find out how to use the LED on the Pi Cap

How to use the LED on the Pi Cap

Explore the Pi Cap's features: Check out the audio output as well as the status LED

Pi Cap Features

Set the Pi Cap either as a touch or proximity sensor

How to make a proximity sensor with your Pi Cap

Categories

Bare Conductive

Instructions

Pi Cap

Date Posted

2018/07/31

Rating

0.00 avg. rating (0% score) - 0 votes