## BrickPi Selfie Stick

Turn your BrickPi into a Selfie Stick.

Once you have your camera working, you should test out the selfie stick code. You should first plug your touch sensor into Port 2 of your Brick Pi.

At this point, you’ll probably want your Pi connected to a display and control setup of some kind (either a monitor/keyboard/mouse combo, or a virtual connection–check out the tutorial here for tips.)

Once you’re all set up, you can download the code here. You can either get your Pi on the internet and download straight to it from the GUI, or you can download on another computer and use a USB stick to transfer the program (see here for linux tips with USB drives.) I named my file “selfie_stick.py”.

It’s a good idea to start a folder for your selfie stick project. You can save the Python file in there, and save your test photos in that folder as well. To make this folder your working folder so the images you are about to take are saved in it, navigate to it via the terminal using the “cd” command. In the following example, I navigate to my Pi’s desktop, create a new folder named “Selfie_Stick” and then make that new folder my working directory.

cd ~/Desktopmkdir Selfie_Stickcd Selfie_Stick

You’ll also need to put a copy of a piece of the Dexter Industries image in your working folder– just the “BrickPi.py” file. You can do this through the terminal or using the GUI. Either way, copy and paste the file into your folder.

To test the code in the terminal, type in “python”, followed by the name of your file. In my case this is: “python selfie_stick.py” and hit enter. You should see the word “RUN” appear, like this:

Hit the touch sensor and see what happens. You should see a red light appear on your Pi Camera, and an image appear on your screen. This means a photo was taken! If nothing happens, and all you see is the word “RUN,” that means something is not quite right. Double check that you’ve got both your selfie stick file and the BrickPi.py file in your current folder, and make sure your touch sensor is plugged in to the correct port.

Optional Bonus Step: You may want to set it up so your selfie stick code launches every time your BrickPi starts up, so you don’t have to keep plugging in a monitor and sending the file over. Unlike an Arduino, the Pi won’t just store your program unless you tell it to – check out these instructions to have your Pi run your selfie stick program every time it boots.