hey guys I'm trying to get my trinket to rotate a servo to random positions but it doesn't seem to want to cooperate here is the code I'm using:
#include <Adafruit_SoftServo.h>
Adafruit_SoftServo xservo;
int xpos;
void setup()
{
xservo.attach(1); // attaches the servo on pin 1 to the servo object
}
void loop()
{
xpos = random(180);
xservo.write(xpos);
delay(1000);
}
volatile uint8_t counter = 0;
SIGNAL(TIMER0_COMPA_vect) {
counter += 2;
if (counter >= 20) {
counter = 0;
xservo.refresh();
}
}
but it just rotates the servo one direction and keeps trying to rotate in that direction even tho its at the end of the servos range of motion.
i have the gnd to brown, the red to 3v on trinket and the orange signal to #1 and I'm having zero luck... any suggestions? what am i missing!?