====== 1.0. 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 or similar) installed * Your system is connected to the internet The Mint-18 distribution of Linux can be downloaded here: http://www.linuxmint.com Although this procedure uses Linux Mint-18, it //should// work with any Linux distribution that uses the Debian package manager (e.g. Ubuntu). **IMPORTANT:** due to USB conflicts, attempting to use Pixy with a virtual machine is NOT recommended. ====== 2.0. Procedure ====== ===== 2.1. Install dependencies for building libpixyusb2 ===== Start the terminal application: {{wiki:img:78184a8b63cf10782c18339b791db9f85a0d8bc0.png?400}} In the terminal window type: ''%%sudo apt-get install git libusb-1.0-0-dev g++ build-essential%%'' ===== 2.2. Build libpixyusb2 ===== ==== 2.2.1. Download Pixy2 source code ==== In the terminal window type: ''%%git clone https://github.com/charmedlabs/pixy2%%'' {{:wiki:v2:git_clone.png?400|}} ==== 2.2.2. Build the library ==== In the terminal window type: ''%%cd pixy2/scripts && ./build_libpixyusb2.sh%%'' {{:undefined:build_libpixyusb2.png?400|}} ====== 2.3. Example projects ====== Before trying the examples below, connect Pixy2 to your Linux system using a USB Micro-B cable: {{wiki:v2:img_5268_result.jpg?400|}} ===== 2.3.1. Color Identification Example (GetBlocksCPPDemo) ===== The example does the following: - Connects to Pixy2 using USB - Displays firmware version installed on Pixy2 - 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. ==== Build the 'get_blocks_cpp_demo' example ==== In the terminal window type: ''%%./build_get_blocks_cpp_demo.sh%%'' {{:wiki:v2:build_get_blocks.png?400|}} ==== Start the example ==== To start the get blocks example, run 'get\_blocks\_cpp\_demo' as root. In the terminal window type: ''%%cd ../build/get_blocks_cpp_demo/%%''\\ ''%%sudo ./get_blocks_cpp_demo%%'' {{:wiki:v2:get_blocks_demo.png?400|}} Block data received from Pixy2 is displayed in stdout. ===== 2.3.2. Line Identification Example (GetLinesCPPDemo) ===== This example does the following: - Connects to Pixy2 using USB - Configures Pixy2 for line feature identification ==== Build the 'get_lines_cpp_demo' example ==== In the terminal window type: ''%%./pixy2/scripts/build_get_lines_cpp_demo.sh%%'' ==== Start the example ==== To start the get_lines demo, run 'get\_lines\_cpp\_demo' as root. ''%%cd ./pixy2/build/get_lines_cpp_demo%%''\\ ''%%sudo ./get_lines_cpp_demo%%'' {{:wiki:v2:get_lines_demo.png?400|}} ====== 3.0. Comments ====== We welcome your thoughts and feedback! Please let us know how we can improve...