This code:
Code:
'For(uint8_t i = 0; i < num_servos; i++){
Dim num_servos(8) As Byte
is wrong.
num_servos is a byte value, and must be declared beforehand and initialized to a value of 8. It is NOT an array, just a value that declares the number of servos that you are going to process.
When declaring variables, it is best to put them all in one spot at the beginning, so you can see what is declared and what values or types. ie:
Code:
Dim i As Byte
Dim servo_pos(8) As Word
Dim servocount As Byte
Dim num_servos as Byte
' Fill in values for fixed variables
num_servos = 8 ' Declare number of servos to process in this code
.
.
.
etc
Also, you declare "servo_pos", but the code uses "servopos" in the interrupt routine. Pick one or the other.
Then, in the MAIN code, you need another loop to initalize the servo position. Original code starts as:
Code:
'For(uint8_t i = 0; i < num_servos; i++){
Dim num_servos(8) As Byte
'servopos[i] = 1.5 * 8000;
servo_pos(i) = 1.5 * 8000
.
.
.
etc
You need to put in a similar loop, similar to:
Code:
For i = 0 To num_servos - 1
[QUOTE]
servo_pos(i) = 1.5 * 8000
[/QUOTE]
.
.
.
etc
...
next i