Hi forum.
Let's try to explain my problem:
I know for sure it's easy but I cannot figure it out..
I have defined a 360 entry array "complete_array[360]" each column representing the 360 degrees circular position that fed into a servo will move it in a sinusoidal way back and forth.
Let's consider just one servo:
the function read_from_array as following:
void read_from_array() {
if (millis() - previous_interval >= servo_update_interval) {
pwm.setPWM(servo, 0, complete_array[array_Index]);
}
if (array_Index >= 359) array_Index = 0;
else array_Index++;
previous_interval = millis();
}
}
Simply every updated interval it reads the array_index and sets the servo to that position.
Now my question:
I would like to access that array in different manners and starting from different starting positions using the millis() method:
from beginning to the end ( ok that's what it is doing actually) but also
from end to beginning,
back and forth, (begin->END->END-> BEGIN)
from a defined position (let's say 200 until the end and then back starting from 0).
all this using millis()
Maybe too hours of coding are obfuscating my poor C skills....
Just to keep it simple I will further explain my end goal, if someone is interested.
Thank You,
Best regards.