Hi,
I'm using SD110, SDK 10.0.0, nRF51822
In my own application, I control 4 servo by pwm with Timer1 and Timer2,
and I have 2 buttons, each button is a flag for moving servo1,2 and servo3,4.
When button1 occur button_interrupt, a flag which I declared refer move_servo1_or_servo2.
This is example code :
button_handler()
{
switch(pin)
{
case button1:
flag = move_servo1_or_servo2;
break;
case button2:
flag = move_servo3_or_servo4;
break;
}
}
int main()
{
while()
{
if(flag != null)
{
move_servo(flag);
}
}
}
Until now, This is not a problem, but I need to control servo within interrupt.
For example :
button_handler()
{
switch(pin)
{
case button1:
move_servo1();
break;
case button2:
move_servo2();
break;
}
}
Like above,
The problem is when I deal with controling servo in interrupt, application is stopped every activity, or something unpredictable result.
How do I solve it?
Thaks,