Open source, Open mind.

Programming in C++ for Raspberry Pi 3







This video talks about the Raspberry Pi and shows some example projects running on the device.


If you do not already have one, a Raspberry Pi is an inexpensive computer that you can purchase from around $35 and use for a lot of different stuff. I being a programmer was interested in it for what I could use it for with projects or just to test software on ARM devices. The Raspberry Pi 3 contains a 1.2 GHZ quad-core ARM Cortex A53 (ARMv8 instruction set), 1 GB memory and Wireless LAN and Bluetooth 4.0

So what is the purpose of this video? I am going to show you a few cross-platform projects I have written and shows how they run on the Pi. Cross platform is the key here because C and C++ are supported on many platforms, you can use cross-platform libraries to create code that can compile for multiple platforms.

The first thing you will need is a MicroSD card and to install PIXEL using NOOBS. I purchased a kit off of Amazon (CanaKit) that came with a Raspberry Pi, Power Adapter, MicroSD card and HDMI cable. I will assume you have PIXEL installed.

When you first boot open into PIXEL and install some packages. The packages used for these demos are gcc, g++, automake, autoconf, SDL, SDL_ttf, SDL_mixer, OpenCV, and Qt4

First Project: Hello World
URL: https://github.com/lostjared/cplusplus11.Examples/blob/master/readfast_textscroll/linescroll.cpp

So the language we are going to be using for this first project is C++. Instead of just doing a boring text printing of Hello World, this program will also print character by character some information about the Raspberry Pi.

Second Project: MasterPiece.SDL
URL: https://github.com/lostjared/MasterPiece.SDL

This project is using SDL/SDL_ttf. This allows me to compile for multiple platforms as long as I do not use any platform specific libraries unless I were to use conditional compilation. This program is a simple 2D Match the blocks style game. The point of the game is you line up three blocks of the same color in either a horizontal, vertical, or diagonal line to clear them from the screen. The graphics for the start screen has the word 'MasterPiece' spelled incorrectly.

Third Project: LostMasterPiece
URL: https://github.com/lostjared/lostmasterpiece

This is a modification of the original MasterPiece adding confusing graphical effects to change the gameplay of the game. Lots of fun

Fourth Project: Acid.Cam.Qt
URL: https://github.com/lostjared/Acid.Cam.v2.Qt

This project is using a graphical user interface instead of just a game window. This project requires libopencv-dev and libqt4-dev. On the Raspberry Pi it works in video mode and allows you to select a video file and some filters, and it will process the video and output a video file.

Bonus Project:
URL: https://github.com/lostjared/Super.Stoner.420

You can enter text mode by pressing CTRL + ALT + F1 or using raspi-config Type in the terminal: sudo raspi-config and set the device to login in textmode. When in text mode you can run SDL applications from the terminal and they will use directfb and smaller resolutions will be stretched to fullscreen.

Conclusion:

From what you saw here you can see that the Raspberry Pi is very easy to program. Not having to compile cross compilers and just being able to login to the system with a keyboard and mouse and compile your programs. It can save a lot of time and headache. I would also recommend enabling ssh and using a key, so you do not have to enter your password each time. With ssh enabled you can copy files with scp from your computer directly to the Pi. If your thinking about buying one I would say go for it because they are cool devices and tons of fun to code for.

Like this page

Notice

All The software on this site is free and Licensed under the GPL
Please Feel Free to Redistribute (As a Free Download) any of the software on this page.

Search

Loading search widget...

Updates View All

UPDATE @ Sun May 14 09:59:54 PDT 2017
Acid Cam for macOS supports 4K resolution so added a sample in 4K on YouTube. Acid Cam v2 Qt is now supported on Raspberry Pi 3/Raspbian.

UPDATE @ Sun Jan 8 10:58:07 PST 2017
Added new version of Acid Cam (v2.1.1) and a few new blog posts. Be sure to check out my GitHub page.

UPDATE @ Thu Dec 15 16:42:56 PST 2016
Updated bug report page with current projects on GitHub. Been working on Acid Cam v2.1.0 and adding new videos to the YouTube channel.

UPDATE @ Sun Jun 19 00:37:30 PDT 2016
Added XChip project to the blog I helped work on with my friend on GitHub.

UPDATE @ Thu Apr 7 11:56:17 PDT 2016
Added new version of Acid Cam for MacOS X.

UPDATE @ Wed Apr 6 08:52:07 PDT 2016
You can now download Acid Cam from Google Play.

UPDATE @ Fri Apr 1 09:59:08 PDT 2016
Finally signed up for twitter you can follow me here.

UPDATE @ Wed Oct 28 10:45:42 PDT 2015
This site now has a BitTorrent Tracker so I can share larger files.

UPDATE @ Sat Sep 12 04:07:24 PDT 2015
Added fixed versions of Super Stoner 420 and Apps collection that fix the issues with the software when running on MacOS X Yosemite.

UPDATE @ Mon Jun 15 15:35:52 PDT 2015
Spent a long time trying to figure out why OpenCV would not compile on Yosemite. Figured it out and statically linked Acid Cam VR 1.1 with the libraries so you no longer need the MacPorts version of OpenCV installed to /opt/local for it work. It should work as long as you have the Oculus Runtime.

UPDATE @ Sat Jun 6 16:11:40 PDT 2015
Added Acid Cam VR for Oculus Rift DK2 to the site with a version for Windows and MacOS X.

UPDATE @ Sun May 17 14:39:14 PDT 2015
It seems the first version of Acid Cam (1.7.7) is incompatible with MacOS X Yosemite for some reason. So if you using Yosemite just pick up version 2 of the program.

UPDATE @ Tue May 12 14:48:53 PDT 2015
Bad news, seems apple deprecated and now dropped support for one of the libraries that SDL 1.2 that I used to compile the majority of the games on this site. So that means I have to recompile and repackage the majority of these programs to get them to work on Yosemite. So the last version supported was 10.9.

UPDATE @ Fri May 8 10:30:56 PDT 2015
Added our first program for the Oculus 2. It requires that you at least have have the Oculus 2 Runtime.

UPDATE @ Wed Feb 11 11:24:23 PST 2015
Added a few new posts to my blog and have been adding new examples to my C++11 Repository

UPDATE @ Sat Dec 13 17:27:03 PST 2014
Added up to date version of Acid Cam 2 for Microsoft Windows.

UPDATE @ Wed Dec 10 11:12:16 PST 2014
The Site has been redesigned and its looking great. Thanks to my friend Daniel Daley who designed the page.

UPDATE @ Thu Oct 9 11:12:06 PDT 2014
Added a image file with the different LostSideDead graphics programs I have created. AlphaFlame HD Launcher needs to be copied to /Applications .

UPDATE @ Thu Oct 2 17:32:12 PDT 2014
Added a new version of Acid Cam v2.0.17 for Ubuntu Linux

UPDATE @ Fri Sep 19 15:19:11 PDT 2014
Made this music video with Alpha Flame HD quite a while ago, check it out!

UPDATE @ Fri Sep 12 14:56:55 PDT 2014
Added a compressed Archive containing the source code for Acid Cam 2 to the site.

UPDATE @ Thu Sep 11 14:51:50 PDT 2014
Added a video demonstration of Acid Cam for iPhone.

UPDATE @ Fri Aug 29 12:20:41 PDT 2014
Updated Acid Cam to version 2.0.16. Added all the filters from AF_Filter and you can now jump to any frame when processing a video.

UPDATE @ Sat Aug 23 10:23:31 PDT 2014
Collection of Jared Brunis Artwork

Follow Me

Facebook Youtube Google Plus