<< return to Pixycam.com

Pixy cam in a loop (Arduino) wont work

I am trying to run Pixy camera as a tracking mode for a robot. I also have a 1 Sheeld and IR tracking camera. To select between the modes we are simply tying pins we have written HIGH to ground with a switch. Within if or while statements we are running the code for whatever particular mode we are in at the time. However the pixy (and 1 Sheeld for that matter) do not want to work within a if or while loop. Is there a communication problem we are not picking up on (not too familiar with i2c or serial either) or is this a fundamental problem with the processing of the Camera? Any help would be greatly appreciated.

Hello Lonnie,
Are you using and IR-lock camera with a regular Pixy camera? (Is that what you mean by “IR tracking camera”?) Note, there will probably be issues with this because the IR-lock camera uses a branched (older) source tree. But regardless –

If you are using the cable that came with your Pixy to connect to your Arduino, you are using SPI communication. Have you tried to run the hello_world example with your setup as a hardware test, just to make sure your Pixy is behaving as expected?

Edward

Edward Getz wrote:

Hello Lonnie,
Are you using and IR-lock camera with a regular Pixy camera? (Is that what you mean by “IR tracking camera”?) Note, there will probably be issues with this because the IR-lock camera uses a branched (older) source tree. But regardless –

If you are using the cable that came with your Pixy to connect to your Arduino, you are using SPI communication. Have you tried to run the hello_world example with your setup as a hardware test, just to make sure your Pixy is behaving as expected?

Edward

Yes the Pixy works as advertised by its self. The IR camera we are using is DF robot IR-Tracking camera. Yes we are using the SPI communication with the 6 pins near the middle of the Arduino Mega. The IR camera uses pins 20 and 21 (SDA SCL) and I believe the communication may be a problem. Possibly using different serial buses may be the ticket. However my knowledge of serial communication is not the best. Any more help would be greatly appreciated. Here is a copy of the code we are using.

Hello Lonnie,
It sounds like the IR camera uses I2C, which is good because I2C should not interfere with the SPI communications.

A good way to debug this is to use the additive approach. Start with a program that communicates with Pixy, then add various features, IR, etc. Test at each step. There may be something that’s interfering. Either code is setting a clock that the SPI uses (for example) or a module uses the same SPI pins that Pixy is using. You can find the culprit when Pixy stops working.

Hope this helps!

Edward