I'm trying to simplify the content of the movement function () to two loops, but doing it in loops does not do anything to me. My code is as follows:
int movimimiento(){
mueve_servo(&patas[1][1], mov_home[1][1]);
mueve_servo(&patas[1][2], mov_home[1][2]);
mueve_servo(&patas[3][1], mov_home[3][1]);
mueve_servo(&patas[3][2], mov_home[3][2]);
mueve_servo(&patas[5][1], mov_home[5][1]);
mueve_servo(&patas[5][2], mov_home[5][2]);
}
My question is how I can put the content in the form of loops to reduce code and especially that it has the same functionality. I have done the following, but it does not do anything to me:
int numero_patas[3] = {1, 3, 5};
int num_art[2] = {1, 2};
for(int pata = 0; pata < sizeof(numero_patas); pata++) {
for(int art = 0; art < sizeof(num_art); art++) {
mueve_servo(&patas[numero_patas[pata]][num_art[art]], mov_home[numero_patas[pata]][num_art[art]]);
}
}
Thank you very much !!