I need to upload an array of values using QGC or directly in the code I could upload a file from SD-card
Here is my code:
`
static const char *file = PX4_ROOTFSDIR"/fs/microsd/file.txt";
int opener = open(file, O_RDONLY, PX4_O_MODE_666);
const int size = 20;
double arr_val[size];
char arr_read[size/2];
if (opener < 0) {
PX4_ERR("Can't open file %s", file);
}
ssize_t const reader = read(opener, arr_read, size);
if (reader != size)
PX4_ERR("Size not match \n");
int k = 0;
for (int i = 0; i < size; i += 2)
{
int val = atoi(&arr_read[i]);
arr_val[k] = val;
k++;
}
`
File contains : 1 2 3 1 4 3 1 … etc
And I need float values, how could I do it ?