Pages: [1]   Go Down
Author Topic: Help with timer interrupt  (Read 227 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello people!I'm pretty new to arduino, but I have programming experience in other platforms. I'm doing a robotic arm with 5 degrees of freedom and need to program the paths. Basically the function that I have to make it´s 5th order polynomial that determines the path I wish to make each joint. The function is as follows:

θ (t) = a_0 + a_1 + a_2 * t * t ^ 2 + a_3 * t ^ 3 + t ^ a_4 * 4 + a_5 * t ^ 5

My only problem is the variable t (time), i desire that path last two seconds with step 0.05s.
The question is how to perform a routine to perform this function every  0.05s.

I thought a timer interrupt every 0.05s counting interruptions up to 2 seconds.

I hope I explained well. Greetings and Thanks!
Logged

Offline Offline
Edison Member
*
Karma: 33
Posts: 1435
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That, or just keep monitoring millis() in a loop and act every 50. See the "Blink without delay" example.

Note that you should not do much in an ISR, especially calculate that polynomial!
Logged

Pages: [1]   Go Up
Jump to: