Hello duiners,
I have a question about the library Ticker.h but, first of all, I want you to know I'm dev'ing on an ESP8266. I know the libraries aren't the same but it looks like there are very similar.
I need to pass an argument to a callBack function of a ticker using but this argument MUST be a pointer to a structure.
It compiles with no error or warning about it but When I print a value pointed by my arument, the value does not make any sense. Here an exemple code.
#include <Ticker.h>
struct curmean{
int mean;
int n;
int N;
};
Ticker T;
void test0(curmean* src){
Serial.println(src->N);
}
void test(){
curmean* arg = {1, 2, 3};
T.attach_ms(500, test0, &arg);
}
void setup(){
Serial.begin(115200);
while(!Serial);
test();
}
void loop(){}
output:
100
100
100
100
100
...
…
do you know how I can manage to pass this structure to the callback function without pointers and global variables (meh)?
thanks for your help :3