<< return to Pixycam.com

Pixy init() stops my arduino from working?

Hi, I’m trying to connect my pixy to my arduino uno, but it seems whenever I use pixy.init(), I can no longer control my arduino. For example, the following code is suppose to simply ‘beep’ my LED.

@#include <SPI.h>
#include <Pixy.h>

Pixy pixy;
int led = 13;

// the setup routine runs once when you press reset:
void setup() {
pinMode(led, OUTPUT);
pixy.init();
}

// the loop routine runs over and over again forever:
void loop() {
beeper();
}

void beeper(){
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000);
}@

This code does not work when I upload it, but if I take out only the pixy.init(), it will work. Can someone possibly help me out as to why this is happening?

Hi,
First, does the “hello_world” Arduino example work for you?

Assuming it does, what do you mean by “I can no longer control my Arduino”? The LED doesn’t flash?

thanks!

I am having the same problem.

I am testing a very simple program that moves a little robot forward on two continuous rotation servos plugged into ports 12 and 13. When I include the pixy.init() command, the servos behave erratically, and when I don’t, it drives forward perfectly.

Hello Dakota,
You are saying that if you do call pixy.init() (where pixy is a “Pixy” object) and do nothing else (essentially while(true); ) the servos behave erratically? I wonder if setting up the SPI port is affecting the timing of the servo signals. Are you using an Arduino Uno?

Edward