I have my Pixy connected to an Arduino Uno which is mounted onto a small robot chassis with two continuous rotation servos to control the wheels. The pan/tilt mechanism is connected on top of the robot assembly, with the pan/tilt servos connected directly to the Arduino, not Pixy. Arduino is able to control all four servos perfectly as I specify, but upon inserting the pixy.init(); command into my program, all four servos start spinning wildly out of control for what seems to be no reason whatsoever. Pixy still returns whatever block characteristics I call from it, but the servos go on the fritz. I can’t figure out why this one line of code is doing this. Could anyone explain why this is the case and how I can fix it?
#include #include #include Servo pan; Servo tilt; Servo right; Servo left; Pixy pixy; void setup() { Serial.begin(9600); Serial.println("START!"); pan.attach(10); tilt.attach(11); right.attach(12); left.attach(13); pan.write(110); tilt.write(120); pan.write(180); delay(1000); pan.write(40); delay(1000); pan.write(110); tilt.write(120); } void loop() { pixy.init(); //<==================== **This line is causing the problem. The servos start spinning out of control past this point.** pixy.getBlocks(); Serial.println(pixy.blocks[0].width); }