Teach Pixy an object

Version 4 (Rich LeGrand, 02/17/2014 10:35 pm)

1 1 Rich LeGrand
h1. Teach Pixy an object
2 2 Rich LeGrand
3 2 Rich LeGrand
Teaching Pixy an object is super easy, but first let's talk about which objects will work well with Pixy.  Pixy uses a hue-based color filtering 
4 3 Rich LeGrand
algorithm to detect objects.  Since Pixy uses hue (color), the object needs to have a distinct hue.  Here are some objects that are good because
5 2 Rich LeGrand
they have good, distrinct hues.
6 2 Rich LeGrand
7 2 Rich LeGrand
**
8 2 Rich LeGrand
**
9 2 Rich LeGrand
10 2 Rich LeGrand
Here are some bad objects because either there is no hue (black, white or gray) or the hue is not distinct.  
11 2 Rich LeGrand
12 2 Rich LeGrand
**
13 2 Rich LeGrand
14 2 Rich LeGrand
**
15 2 Rich LeGrand
16 4 Rich LeGrand
Keeping these guidelines in mind, choose an object to teach Pixy.  (Apply power to Pixy via battery or USB cable if you haven't already.  When you power up Pixy, it will go through a series of LED flashes.  Wait for the led to turn off before teaching Pixy.)  Hold down the 
17 4 Rich LeGrand
button on top of Pixy.  After about 1.5 seconds, the LED will turn on, first white, then red, 
18 4 Rich LeGrand
(then other colors), but when it turns red, release the button.  
19 4 Rich LeGrand
20 4 Rich LeGrand
When you release the button, Pixy will enter what's called 
21 4 Rich LeGrand
"light pipe" mode, where the LED color is the color of the center pixels of Pixy's image frame.  
22 4 Rich LeGrand
23 4 Rich LeGrand
** quick video
24 4 Rich LeGrand
25 4 Rich LeGrand
Use the LED color as feedback to determine if your object is in the center of Pixy's image frame.  When you are satisfied that the LED color 
26 4 Rich LeGrand
matches your object color) release the button.  If Pixy determines that the hue of      
27 4 Rich LeGrand
your object is "good enough" (has enough color saturation), the LED will flash several times and you're done.  Pixy has "learned" your object
28 4 Rich LeGrand
and will start tracking objects of the same color.  If the hue is not good enough, the LED will simply turn off and Pixy will not have learned your object.  You should possibly choose another object that has a better color saturation, or consult the Pixy troubleshooting section**.