Hi fellow engineers,
i had a hunch and wanted to test something:
could someone tell me why i am not getting the values from my function in the other function?
the debugging from my code will continue tomorrow, but to prevail and get a cleaner code I wanted to test some code online.
the values from the static double ArrTemp[]; should resemble an array of 4 Thermocouples K that are a readout by the MAX31855, and should be transferred to another function void receiutveFunction( double *p) and printed out.
i would like to know how to do this, because then all of my code will be turned to voids and I can integrate timing calls for the other functions and hopefully get no TFT screen freeze. see previous posts:
could someone tell me what I am doing wrong? or is this not possible in the arduino environment with the libraries I have?
i have later the same idea with my encoder function that writes the int menu to the TFT function
the output data needs to be double as same as the input data from the array.
i had a hunch and wanted to test something:
could someone tell me why i am not getting the values from my function in the other function?
the debugging from my code will continue tomorrow, but to prevail and get a cleaner code I wanted to test some code online.
the values from the static double ArrTemp[]; should resemble an array of 4 Thermocouples K that are a readout by the MAX31855, and should be transferred to another function void receiutveFunction( double *p) and printed out.
i would like to know how to do this, because then all of my code will be turned to voids and I can integrate timing calls for the other functions and hopefully get no TFT screen freeze. see previous posts:
HTML:
https://forum.pjrc.com/threads/63152-More-questions-SPI-Manual-Correctly-Previous-Post-MAX31855-Screen-Freezes-why-CLK?highlight=max31855
could someone tell me what I am doing wrong? or is this not possible in the arduino environment with the libraries I have?
i have later the same idea with my encoder function that writes the int menu to the TFT function
Code:
#include <stdio.h>
Void
#include <stdio.h>
void *passArray()
{
static double ArrTemp[] = { 22.33, 22.74, 22.30, 24.00 };
int i;
for (i = 0; i < 4; i++)
{
printf ("value inside Array is:\n ");
ArrTemp[i];
printf("Array[%d] = %.2lf", i, ArrTemp[i] );
}
return ArrTemp;
}
int
main()
{
printf ("print array to another function\n");
double *p;
p=passArray();
receiveFunction();
}
void receiveFunction( double *p)
{
for (int i = 0; i < 4; i++)
{
//printf ("*(p + %d) : %d\n", i, *(p + i));
printf("Receive Element[%d] = %.2lf\n", i, p[i] );
}
return 0;
}
the output data needs to be double as same as the input data from the array.