TLC5940 is a 16 channel PWM chip. I am currently using the library: GitHub - PaulStoffregen/Tlc5940: 16 channel PWM LED driver based on the Texas Instruments TLC5940 chip.
There is a integer somewhere in this code such that the width 466 is the maximum you can set, and any number greater will cause an integer overflow and reset the angle values.
In example:
The code below will move to the upper limits. (all the way left then right)
// 1ms pulse is 204
#define SERVO_MIN_WIDTH 102
// 1.5 ms is 307
// 2ms pulse is 410
#define SERVO_MAX_WIDTH 466
//#define SERVO_MAX_WIDTH 467
#include <tlc_servos.h>
#include <Tlc5940.h>
int pinval = 0;
void setup(){ tlc_initServos(); }
void loop(){
tlc_setServo(pinval, 0);
Tlc.update();
delay(2000)
tlc_setServo(pinval, 180);
Tlc.update();
delay(2000);
}
The code below will move to one direction and stay there.
// 1ms pulse is 204
#define SERVO_MIN_WIDTH 102
// 1.5 ms is 307
// 2ms pulse is 410
//#define SERVO_MAX_WIDTH 466
#define SERVO_MAX_WIDTH 467
#include <tlc_servos.h>
#include <Tlc5940.h>
int pinval = 0;
void setup(){ tlc_initServos(); }
void loop(){
tlc_setServo(pinval, 0);
Tlc.update();
delay(2000)
tlc_setServo(pinval, 180);
Tlc.update();
delay(2000);
}
also there 2 codes are functionally equivalent:
// 1ms pulse is 204
#define SERVO_MIN_WIDTH 102
// 1.5 ms is 307
// 2ms pulse is 410
#define SERVO_MAX_WIDTH 466+ 307 - 102
//#define SERVO_MAX_WIDTH 307
#include <tlc_servos.h>
#include <Tlc5940.h>
int pinval = 0;
void setup(){ tlc_initServos(); }
void loop(){
tlc_setServo(pinval, 0);
Tlc.update();
delay(2000);
tlc_setServo(pinval, 180);
Tlc.update();
delay(2000);
}
// 1ms pulse is 204
#define SERVO_MIN_WIDTH 102
// 1.5 ms is 307
// 2ms pulse is 410
//#define SERVO_MAX_WIDTH 466+ 307 - 102
#define SERVO_MAX_WIDTH 307
#include <tlc_servos.h>
#include <Tlc5940.h>
int pinval = 0;
void setup(){ tlc_initServos(); }
void loop(){
tlc_setServo(pinval, 0);
Tlc.update();
delay(2000);
tlc_setServo(pinval, 180);
Tlc.update();
delay(2000);
}
Help me out.