Go Down

Topic: sub-routines HELP (Read 1 time) previous topic - next topic

hello all, i am trying to make a sub-routine i am not sure how to do this. i want to have one loop main, and only call functions. i would like to be able to re-name the functions.

For example

main loop
{
   call function 1
   call function 2
   return
}
if anyone could help me with this that would be great.

PeterH

I only provide help via the forum - please do not contact me for private consultancy.

marco_c

setup() and loop() are already subroutines (called functions in C/C++), so even if you don't know it you have written functions already.

You can call functions just abot anything you want and the code will look something like this:

Code: [Select]
int function1()
{
}

int function 2()
{
}

void loop()
{
  function1();
  function2();
}


I am sure you get the idea. You should also look at at C/C++ tutorial as already suggested.
Arduino libraries http://arduinocode.codeplex.com
Parola for Arduino http://parola.codeplex.com

Go Up