Well first of all, that's my first thread and I'm sorry if I posted in the wrong section.
My current project gets values from VirtualWire using of course VirtualWire.h which is incompatible with Servo.h because of TIMER1. The values I'm sending with VirtualWire are actually the angle the servo needs to rotate.
What I realised is that ServoTimer2 uses microseconds to control the servo (if someone can explain me this in deep I'll be very tahnkfull) and not with degrees, what I had programmed (and can't be changed at the moment).
What I've tried so far is to map() the value of the angle like this:
for (int i = 0; i < 5; i++) {
angleServoTimer[i] = map(angleString[i].toInt(), 0, 180, MIN_PULSE_WIDTH, MAX_PULSE_WIDTH);
servoMotor[dit].write(angleServoTimer[i]);
}
I've realised though, that sending a 180 it actually writes MAX_PULSE_WIDTH, but the servo does not move 180 degrees. Even hard-codding MAX_PULSE_WIDTH and MIN_PULSE_WIDTH to 755 and 2250 like the library suggests:
#define MIN_PULSE_WIDTH 750 // the shortest pulse sent to a servo
#define MAX_PULSE_WIDTH 2250 // the longest pulse sent to a servo
Although I'm feeling a bit confused on ServoTimer2.h when I read this:
/* attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
* default min is 544, max is 2400
*/
Is there a way to precise this? My project depends on the angles the servo should rotate.
Every help will be apracated, and a bit urgent, thanks!