<< return to Pixycam.com

Raspberry Pi 2: C/C++ examples?

hello,
I’m new to Pixy and Raspi, I would like to use C/C++ for the Raspi and better would not wish to use USB but i2c or SPI (all Raspi USB ports are taken, and I can’t use a USB dongle).

Where to find installation guides for C/C++, i2c, SPI, and example source code?

Which interface of i2c or SPI would work most easy and reliable?

Hello,
There are no libraries for Raspberry Pi to talk over I2C or SPI (that I know of). We have a porting guide that can help:

http://cmucam.org/projects/cmucam5/wiki/Porting_Guide

Sorry! I think everyone is using USB with RPi.

Edward

I don’t understand what you want to say by
“We have a porting guide that can help: http://cmucam.org/projects/cmucam5/wiki/Porting_Guide

that source is big enough to sink a ship, and extremely vague and ambiguous -
what is that about? I don’t see through it.

I already have plugged a keyboard and a mouse to my Raspberry, so why do I need a USB Hub and extra mouse and keyboard?

And I have already installed Raspibian Jessie, I don’t want to change my current setup, settings, and adjustments, so why do I have to install Raspbian again, anew?

And I only use C/C++, no Python and no bash scripts at all, so your .sh examples are of no value to me.

so, again please:

Is there a way to use i2c or SPI now nevertheless?

Where can I find C/C++ sources which work with the PixyCam out of the box, with either interface (perhaps even USB)?

I just want to load the C/C++ source codes into Geany, compile, build, and run!

The Porting Guide is for anyone who wants to get their platform talking to Pixy. It describes the protocol that Pixy uses and walks you through various steps to get Pixy and your platform conversing. You asked about I2C and SPI on the Raspberry Pi. I don’t know of any libraries that support this, so I suggested the Porting Guide.

If you can somehow use USB on your RPi, by freeing up a port or using a hub to add more ports, this will help you get your Pixy talking to your RPi over USB:

http://cmucam.org/projects/cmucam5/wiki/Hooking_up_Pixy_to_a_Raspberry_Pi

which part of

“Where can I find C/C++ sources which work with the PixyCam out of the box, with either interface (perhaps even USB)?
I just want to load the C/C++ source codes into Geany, compile, build, and run!”

did you not understand ?!?

Finally I want to integrate the BLOB recognition into my own proprietary gpp C/C++ program for a mobile robot!!

I’m sorry, I thought I provided what you wanted here:

http://cmucam.org/projects/cmucam5/wiki/Hooking_up_Pixy_to_a_Raspberry_Pi

This describes how to get Pixy talking to Raspberry Pi over USB.

I don’t want to know how to connect to USB,
I want to see C/C++ source code examples for the Raspberry Pi.

Is that so hard to understand?

After you grab the git repository, look in the “scripts” directory. It has some examples that you can build, e.g. pan/tilt demo, pan/tilt python, and hello pixy. After you run a build script (you just execute them in a command shell) you go into the “build” directory and look for the directory of the same name to find the executable.

The source code is also in the git repository in the “src” directory. Here they are for your convenience:

Edward

I don’t see a section for “Raspberry Pi”

It’s not about Python!
And I don’t want to build a script!!

e.g.,
having installed the Pixy libs for Arduino, then there are C Sketch examples in the folder …\Arduino\libraries\Pixy\examples
(or something like that)

I am looking for files like that on the Raspberry Pi, plus a tutorial what they do and how to use them.

shift left,
Perhaps if you describe to us what you are trying to do, it will help us meet your needs better.

Edward

I have built a mobile robot (differntial drive, tank track treads, rotary encoder motors, plus a robot arm).

I want the robot to detect colored objects
(like your little pixy bot following a blue or a red ball): https://www.youtube.com/watch?v=ken1zjEb3OM ,
perhaps to grab them, and I want the robot to detect color codes on the walls for navigation purposes.

The robot is controlled by a Rasperry Pi 2 programmed in C/C++ plus some multiplexer boards and several sensors (IMU, GPS, GP2D12, perhaps a LIDAR for the future) and now I want to implement these cam-based object detection features additionally by simply #including the pixy libs for Linux C/C++ just like one is able to do it by Arduino Sketch code.

Sounds cool :slight_smile: Are you using a webcam of some sort for vision?

a webcam? no - why should I?

What of my question is so hard to understand? I want just the Pixy Cam to use!

I have built a mobile robot (differntial drive, tank track treads, rotary encoder motors, plus a robot arm).

I want the robot to detect colored objects
(like your little pixy bot following a blue or a red ball): https://www.youtube.com/watch?v=ken1zjEb3OM ,
perhaps to grab them, and I want the robot to detect color codes on the walls for navigation purposes.

The robot is controlled by a Rasperry Pi 2 programmed in C/C++ plus some multiplexer boards and several sensors (IMU, GPS, GP2D12, perhaps a LIDAR for the future) and now I want to implement these cam-based object detection features additionally by simply #including the pixy libs for Linux C/C++ just like one is able to do it by Arduino Sketch code.

now again, slowly it’s getting annoying:

Where to find Raspi C/C++ libs,
C/C++ example source code,
and a tutorial how to use them all,
probably for Raspi-Pixy-USB connection?

Sorry, no tutorials for C/C++ examples on RPi. You are the first person to ask. Most find that build scripts are sufficient.

I already pointed you to the source code.

Edward