Problem with custom data types
hello all!
i trying code work using custom data types.
the types defined this:
i create array:
i try set contents of array using function
but when arduino crashes.
i can access item in array other point this:
or using in set_sticks() function.
does have idea why might not working? can't head around it.
i trying code work using custom data types.
the types defined this:
code: [select]
typedef struct
{
int top;
int center;
int bottom;
int input;
int type;
int trim;
int rates;
int position;
} stick;
i create array:
code: [select]
stick sticks[4];
i try set contents of array using function
code: [select]
void set_sticks()
{
for (int = 0; < 5; i++) {
sticks[i].top = stick_limits[i][0];
sticks[i].center = stick_limits[i][1];
sticks[i].bottom = stick_limits[i][2];
sticks[i].type = stick_types[i];
sticks[i].input = stick_inputs[i];
sticks[i].trim = stick_trims[i];
sticks[i].rates = stick_rates[i];
sticks[i].position = 0;
}
}
but when arduino crashes.

i can access item in array other point this:
code: [select]
sticks[0].top = 200;
or using in set_sticks() function.
does have idea why might not working? can't head around it.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Problem with custom data types
arduino
Comments
Post a Comment