<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:building_the_libpixyusb_example_on_linux

**This is an old revision of the document!**

Building libpixyusb2 on Linux

1. Introduction

The libpixyusb2 library provides a software application programming interface (API) for communicating
with Pixy2 over USB. This allows you to write software that interfaces with Pixy2 like the PixyMon application.

The following procedure will outline the steps required for building the libpixyusb2 library and some example projects using the library. This procedure assumes the following:

  • Your system has Linux Mint-17 installed
  • Your system is connected to the internet
  • libusb version 1.0.9

The Mint-17 distribution of Linux can be downloaded here: http://www.linuxmint.com

Instructions for updating the Pixy2 firmware are here: Uploading New Firmware

Although this procedure uses Linux Mint-17, it should work with any Linux distribution that uses the Debian package manager (e.g. Ubuntu).

2. Procedure

2.1. Install dependencies for building libpixyusb2

Start the terminal application:

2.1.1. Install git

In the terminal window type:

sudo apt-get install git

2.1.2. Install libusb-1.0-0-dev

In the terminal window type:

sudo apt-get install libusb-1.0-0-dev

2.1.3. Install g++ (compiler)

In the terminal window type:

sudo apt-get install g++

2.2. Build and install libpixyusb2

2.2.1 Download Pixy2 source code

In the terminal window type:

git clone https://github.com/charmedlabs/pixy2.git

2.2.2. Build the library

In the terminal window type:

cd pixy2/scripts
./build_libpixyusb2.sh

3. Example projects

Before trying the examples below, connect Pixy2 to your Linux system using a USB Mini cable.

3.1. get_blocks: A Simple IO Example

The example does the following:

  • Connects to Pixy2 using USB
  • Block information is displayed (as shown in the image above) if color signatures have been set and if the signatures are currently being detected by Pixy2.

3.1.1. Build the 'get_blocks' example

In the terminal window type:

/pixy2/scripts/build_get_blocks_cpp_demo.sh

3.1.2. Start the example

To start the libpixyusb2 example, run 'hello_pixy' as root.

In the terminal window type:

cd /pixy2/build/hello_pixy
sudo ./hello_pixy

Block data received from Pixy2 is displayed in stdout.

wiki/v2/building_the_libpixyusb_example_on_linux.1530241393.txt.gz · Last modified: 2018/06/29 03:03 by pixycam