i cannot seem to find out what is wrong when compiling the following. I'm trying to learn how to use functions. I don't want to return any values, only pass parameters in to be used in i/o. What am I missing?
void setup() {
Serial.begin(9600);
}
void loop();
funct(3,5,6);
delay (500000);
}
void funct(int a, int b,int c){
int d=a + b + c;
Serial.println(d);
}
you missed a {
that s why I prefer the { opening bracket on the next line see below
void setup()
{
Serial.begin(9600);
}
void loop()
{
funct(3,5,6);
delay(5000);
}
void funct(int a, int b,int c)
{
int d=a + b + c;
Serial.println(d);
}
Thanks a lot - sometimes the obvious evades detection.
Your delay statement will not produce the intended results, either. Literals are treated as ints, and 500000 is not a valid int value. Either append UL to the end of the literal, or use a more reasonable approach, like not delay()ing at all.