Hello,
probably I am missing something very basic here, but I would appreciate any advice.
I am trying to control the pixy servos from Arduino nano R3, using very simple test code base on pixy.setServos(panPos,tiltPos), but I get no movement at all. here is the code:
#include <SPI.h>
#include <Pixy.h>
//pixy
#define X_CENTER 160L
#define Y_CENTER 100L
#define RCS_MIN_POS 0L
#define RCS_MAX_POS 1000L
#define RCS_CENTER_POS ((RCS_MAX_POS-RCS_MIN_POS)/2)
Pixy pixy;
void setup()
{
pixy.init();
}
void loop()
{
//move both pan and tilt to max position and hold for 2 sec
pixy.setServos(RCS_MAX_POS, RCS_MAX_POS);
delay(2000);
//move both pan and tilt to mid position and hold for 2 sec
pixy.setServos(500L, 500L);
delay(2000);
//move both pan and tilt to min position and hold for 2 sec
pixy.setServos(RCS_MIN_POS, RCS_MIN_POS);
delay(2000);
}
I am expecting this to work, as it would work on any servo. Please note that with the same wiring and power setup, I can run successfully the tiltpan demo from Arduino, I am also able to manually control the servos from pixyMon using rcs_setPos 0 1000, rcs_setPos 0 0,rcs_setPos 1 1000,rcs_setPos 1 0 and all is working fine. am I missing something here?
Appreciate any help
Thanks
Fahed