YESSSS !!!! THats it ...thx :)))
johnwasser:
So something like this? Of course you should use the BlinkWithoutDelay technique to take step one degree every N milliseconds instead of the outer 'degrees' loop and delay().#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x40);
int servomin = 180; //150
int servomax = 400; //600
void setup() {
Serial.begin(9600);
pwm.begin();
pwm.setPWMFreq(60);
}
void loop()
{
oneCycle();
}
void oneCycle()
{
for (int degrees = 0; degrees < 360; degrees ++)
{
float radians = (degrees * M_PI) / 180.0;
for (int servo = 0; servo < 16; servo++)
{
// Map the sin() function to the servomin..servomax range
int position = (sin(radians) + 1.0) * ((servomax - servomin) / 2.0) + servomin;
pwm.setPWM(servo, 0, position);
radians += (2.0 * M_PI) / 16.0; // Advance 1/16th of a circle
}
delay(10); // 3600 milliseconds per cycle
}
}