Hello All!
While I have been tinkering with Arduino in a couple of formats for a while I have yet to make anything of note. I am new to this forum, although I trawl it frequently for answers to niggly questions as they have arisen and have always managed to get a clue that points me in the right direction. This time I can't seem to find an answer [ I have looked ], hence the post.
The code below [ for a hexapod robot] works as expected thus far, but I'm trying to eliminate a dozen or so lines of code per gait. Not convinced this code is what I would ultimately use and the array of data at this point is rubbish but understanding how to parse and array would be of huge benefit about now.
Apologies if I posted this in the wrong category.
Thanks in advance.
Drew
void Gait(int Steps)
{
int g1a = 5; //array dimension 1, this will vary depending on the complexity of the Gait1
int g1b = 12; //array dimension 2. this will vary depending on the complexity of the limbs
int Gait1[g1a][g1b]{
{1,1,1,1,1,1,1,1,1,1,1,1}, //six legs two servos per leg
{2,2,2,2,2,2,2,2,2,2,2,2},
{3,3,3,3,3,3,3,3,3,3,3,3},
{4,4,4,4,4,4,4,4,4,4,4,4},
{5,5,5,5,5,5,5,5,5,5,5,5}
};
//DoGait(g1a, g1b, Gait1[ ]) //HELP!!
// This is the code I would like to implement in DoGait()
for (int s=1; s<=Steps; s++)
{
for ( int i = 0; i<=g1a-1; i++)
{
for ( int j = 0; j<=g1b-1; j++)
{
Serial.println(Gait1[i][j]);
//individual servo work done here.
}
}
}
// to here.
}
void DoGait()
{
}