Hello,
I know that maybe this topic already exists but I didn't found it.
I am new to pointers and trying to find out how they work! The code is as follows :
void (*functii[2])(void);
char stare = 'o';
void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void functie1(void)
{
digitalWrite(13,HIGH);
Serial.println("APRINS");
functii[1] = functie1;
functii[2] = functie2;
}
void functie2(void)
{
digitalWrite(13,LOW);
Serial.println("STINS");
}
void loop()
{
if (Serial.available() > 0){
stare = Serial.read();
Serial.println(stare);
if (stare == 'a')
{
functii[1];
}
else if(stare == 's')
{
functii[2];
}
}
}
My question: Is this not supposed to work?
Is there another way of using pointers?
Thank you!