Controlling a Servo motor using interrupts without servo library
i have been trying control servo motor without servo library due conflict in library using.
a problem have been running servo motor jitters unless send frequency.
i figured use interrupt control servo way sent same frequency , therefore not jitter.
i have never worked timer interrupts before working on dummy code make sure understand it.
here have:
the problem approach pin high , low equal amount of time changing frequency , not position.
is possible have high 30% or 90% of time corresponding position staying @ same frequency?
thanks in advance
a problem have been running servo motor jitters unless send frequency.
i figured use interrupt control servo way sent same frequency , therefore not jitter.
i have never worked timer interrupts before working on dummy code make sure understand it.
here have:
code: [select]
#include <timerone.h>
void setup()
{
//initialize digital pin output.
pinmode(22, output);
timer1.initialize(10000); //set timer of length in microseconds
timer1.attachinterrupt(timerisr); //attach service routine here
}
void loop() {
// put main code here, run repeatedly:
}
void timerisr()
{
//toggle pwm
digitalwrite(22, !digitalread(22));
}
the problem approach pin high , low equal amount of time changing frequency , not position.
is possible have high 30% or 90% of time corresponding position staying @ same frequency?
thanks in advance
Arduino Forum > Using Arduino > Project Guidance > Controlling a Servo motor using interrupts without servo library
arduino
Comments
Post a Comment