Hello all, sorry for the double thread, but I did not know if this was more appropriate as an addendum to my last, or an independent one.
After examining and experimenting with the Pixy2 python API, it looks as though the LED control did not make the cut.
I tried poking around, and adding it myself, but got a segmentation fault.
Here is what I tried…
I added the following code to …/python_demos/pixy.i
/*!
@brief Set upper and lower LEDs
@param[in] upper Turns on the upper LEDs
@param[in] lower Makes all 3 lower LEDs run at full
*/
extern void set_lamp (int upper, int lower);
Then, when that got a name error on import, I poked around some more and added the following code to .
…/python_demos/pixy_python_interface.cpp
void set_lamp (int upper, int lower)
{
pixy_instance.setLamp (upper, lower);
}
I do not really know C++ at all, and so I am sort of feeling my way around the dark, but I would like to get the LEDs working in python.
The C++ API lists it as this…
int8_t setLamp(uint8_t upper, uint8_t lower)
setLamp() turns on/off Pixy2's integrated light source. The upper argument controls the two white LEDs along the top edge of Pixy2's PCB. The lower argument sets the RGB LED, causing it to turn on all three color channels at full brightness, resulting in white light. Both arguments are binary, zero or non-zero. It returns an error value (<0) if it fails and 0 (PIXY_RESULT_OK) if it succeeds.
Does anyone have any idea what I am doing wrong?
Thanks,
R^2