<< return to Pixycam.com

Can't get arduino to do anything else

Hi Folks,

I am struggling a bit using the Pixy in my embedded application.

I am trying now to use the I2C interface after failing for a while with SPI with SS.

Using the I2C hello world program, I can get the communication working pretty well.

If I introduce even the most simplest thing to that program, like adding a Serial.println, there seems to be some sort of breakdown and the communication between the microcontroller and the pixy stops.

Sometimes cycling the power seems to have an effect, but it is unreliable.

FYI I am using a Teensy3.1.

Thanks!

Hello GB,
Hmm, that’s odd. With the UART interface, you can lose data if you aren’t consistently reading, but I2C has flow control built-in.

Make sure you are using the latest Arduino code (ver 0.1.7) and the latest firmware (pixy_firmware-2.0.17-general.hex).

If you have a simple example (e.g. similar to hello_world) that exhibits the issue, please post.

Edward

just adding the tft.fillscreen wreaks havoc. (note that the same thing happens even if this is a Serial.println instead of anything with the tft).
I stop getting all objects reported in the serial monitor (i.e. in pixymon i can see there are 4 objects but the serial monitor only identifies 1) if it works at all. I also have to cycle power every time i upload the program.

//
// begin license header
//
// This file is part of Pixy CMUcam5 or "Pixy" for short
//
// All Pixy source code is provided under the terms of the
// GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).
// Those wishing to use Pixy source code, software and/or
// technologies under different licensing terms should contact us at
// [email protected]. Such licensing terms are available for
// all portions of the Pixy codebase presented here.
//
// end license header
//
// This sketch is like hello_world but uses I2C communications.  If you're
// not sure what I2C is, run the hello_world sketch!
//

//#include 
#include 
#include 
#include "SPI.h"
#include "ILI9341_t3.h"

#define TFT_DC 21
#define TFT_CS 15
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);


PixyI2C pixy;
// PixyI2C pixy(0x55); // You can set the I2C address through PixyI2C object 



void setup()
{
  Serial.begin(9600);
   
   
  tft.begin();
  tft.setRotation(2);
  tft.fillScreen(ILI9341_BLACK);
  tft.setTextColor(ILI9341_YELLOW);
  tft.setTextSize(2);
  tft.println("Waiting for Arduino Serial Monitor...");
  
  delay(1000);
  pixy.init();
 
}


void loop() 
{ 
  
 
  tft.fillScreen(ILI9341_BLACK);

  static int i = 0;
  int j;
  uint16_t blocks;
  char buf[32]; 
  
  blocks = pixy.getBlocks();
  
  if (blocks)
  {
    i++;
    
    // do this (print) every 30 frames because printing every
    // frame would bog down the Arduino
    
    if (i%30==0)
    {
      sprintf(buf, "Detected %d:\n", blocks);
      Serial.print(buf);
      for (j=0; j<blocks; j++)
      {
        sprintf(buf, "  block %d: ", j);
        Serial.print(buf); 
        pixy.blocks[j].print();
     
      }
      
    }
  } 
  delay(1);
}

Hi GB,
Hmm. When we put prints in our programs, it doesn’t affect Pixy communication as you describe. Can you provide a specific example that uses print and causes the issue? We can’t use this code to try to reproduce this issue.

We’ve had users with hardware that affect Pixy’s communication, but this has always been a case of I/O contention. That is, the hardware is affecting the I/O that Pixy uses for communication (in this case, the I2C).

Edward