<< return to Pixycam.com

No responce Pixy2 with STM32 using I2C


I am recently doing a projet with pixy2 and STM32. I would like get datas back to my STM32 from pixy2 using I2c. But the code you provided didnt work with my STM32. I’ve set the I2c communication with pixymon on my PC and connected the STM32 and pixy2 as told in the web. I can get the pixy2 address 0X54 bying using I2c scanner but just cant get the datas back to my STM32. it ssems the pixy.init() is blocking the code from running. Here is my code

#include <Pixy2I2C.h>

Pixy2I2C pixy;

#include <Wire.h> //Include the Wire.h library so we can communicate with the pixy2.

TwoWire WIRE2 (2, I2C_FAST_MODE); //Initiate I2C port 2 at 400kHz.

#define Wire WIRE2

void setup()







void loop()


int i;

// grab blocks!


// If there are detect blocks, print them!

if (pixy.ccc.numBlocks)


Serial.print("Detected ");


for (i=0; i<pixy.ccc.numBlocks; i++)


  Serial.print("  block ");


  Serial.print(": ");





I will be very greatful if you can find the solution. Thank you very much.

I’m not familiar with your microcontroller. It appears that you need to debug the I2C connection to your Pixy2. The best way to do this is to send a simple I2C message to Pixy2 and get a response to make sure you have set up the I2C port correctly on your microcontroller and wired the connections to Pixy2 correctly.

This page describes how:


in particular, this section describes sending a 4-byte message to get the version message from Pixy2:


Once you get this working, you can copy you initialization routines into the communication code.

Hope this helps!