Calling functions

Hi there,

I have a question concerning the calling of function during a sketch.

int outputPin = 13;

void setup()
{
  pinMode(outputPin, OUTPUT);
}

void loop()
{
  digitalWrite(outputPin, HIGH);
  delay(3000);
  void aus();
}

void aus()
{
  digitalWrite(outputPin, LOW);
}

What I am trying to do here is to call the function “void aus()” so that the led turns of. Which syntax do I have to use to get the function “void aus()” running after three seconds? This is just a simplification of the problem I have, but any help on this is greatly appreciated!

'void' is the return type, not part of the function's name. Omit the return type when calling the function.

 aus();

Thank you!

You may find that you must declare the function:

void aus()
{
  digitalWrite(outputPin, LOW);
}

before you call it:

  aus ();

The compiler may give you warnings and/or errors if you call before you've declared. Best to put the function's declaration after the line that sets the output pin, but before "void setup ()".

Anacrocomputer, the arduino build environment automatically creates prototypes for functions in the main tab of a sketch so there is no need to put a function declaration before it is called.

But it is a good habit to get in for people that want to move on to a more traditional C/C++environment.

the arduino build environment automatically creates prototypes

OK, I didn't know that -- thanks!