<< return to Pixycam.com

hello pixy with arduino UNO failed

Pixymon is working nicely, as shown in the following capture.
As 1 group is detected, I stopped Pixymon and tried to collect the same result with hello pixy.
I modified a few the program to get more infos. No group is detected, as printed on the serial monitor inside arduino dev env.

I have carefully read and reread the Troubleshooting Guide : http://www.cmucam.org/projects/cmucam5/wiki/My_Arduino_isn't_receiving_data_from_Pixy

So every thing seems ok and I failed to get infos from Pixy on my arduino UNO.
Is there more simple tests to perform ? For example, a simple program that sends one ‘A’ char per seconde from pixy board to arduino ?

I put down the code, the capture from Pixymon and the capture from the result in the arduino serial monitor.
(Pixymon is off when arduino serial monitor is running)

Thx in advance

/////////////////////////////////////////////////////////

#include 
#include 

Pixy pixy;

void setup()
{  
  Serial.begin(9600);
  Serial.print("Starting...\n");
  pixy.init();
}

void loop()
{
  static int i = 1;
  int j;
  static int k = 1;
  uint16_t blocks;
  char buf[32];   
  blocks = pixy.getBlocks();
  if ((i%6000)==0)
  {
      i = 1;
      sprintf(buf, "Detected %d %d:\n", k, blocks);
      k++;
      Serial.print(buf);
  }
  i++;
}

////////////////////////////////////////////////////////////////////

what do you get with out of the box hello world?

you should have an if(blocks) after getBlocks to see if blocks have been detected, and if ((i%50)==0) for once a sec.

void loop()
{
static int i = 1;
int j;
static int k = 1;
uint16_t blocks;
char buf[32];
blocks = pixy.getBlocks();
if (blocks)
{
if ((i%50)==0)
{
i = 1;
sprintf(buf, “Detected %d %d:\n”, k, blocks);
k++;
Serial.print(buf);
}
i++;
}
}

with “if(blocks)” then the message is printed only if blocks are detected
without this “if(blocks)” then the message is always printed

Even with the out-of-box hello world, Pixmon is detecting blocks and arduino gets no block ?

So as pixy.begin() does not return any value, it is not possible to know if the connexion between arduino and pixy works.

Pixymon works and shows that blocks are detected.
The cable between Pixy and arduino is there.
I checked all the points of the Troubleshouting Guide.
Pixy led is glowing, so it shows again that blocks are detected.
I am using a true arduino UNO and Arduino-1.6.3

Thx for this comment but it is the same.

Ok, I solved the problem. It is elsewhere.

When you start the serial monitor, you have to shutdow Pixymon.
Stopping Pixymon is not enough.

So now it works, when I shutdown Pixymon. :slight_smile:

good catch… assumed ‘stopped’ was ‘shutdown’ :slight_smile:

Hello,
Another thing to keep in mind is that you need to be in Default mode for the Pixy to communicate with Arduino. Cooked mode is a debugging mode where the processing takes place on the PC.

http://cmucam.org/projects/cmucam5/wiki/I_don’t_see_any_video_when_I_run_PixyMon

Exiting PixyMon is another way to put Pixy back into Default mode.

Edward

Hello

I’m having a problem with the “hello world” code as well on Pixy. The given(default) “hello world” code executes up until before the if (blocks) statement. This was checked by printing a statement in the loop where blocks is defined as = pixy.getBlocks();

When I put a print statement in the if (blocks) statement the display is as seen in the attachment. Can you perhaps guide me in fixing this issue as soon as possible, please.

Hello Kasia,
In your picture, PixyMon is in cooked mode. Cooked mode is a debugging mode where the processing is done on the PC. You need to be in default mode in order for Pixy to stream the detected objects through it’s serial ports. Try clicking on the home icon to get into default mode. when you exit PixyMon, Pixy will enter default mode, so you can exit PixyMon, and your Arduino will then receive object data as well.

Edward