Pages: [1]   Go Down
Author Topic: sub-routines HELP  (Read 1010 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12520
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What you need is a C++ tutorial.
Logged

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

Sydney, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1249
Big things come in large packages
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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.
Logged

Arduino libraries http://arduinocode.codeplex.com
Parola hardware & library http://parola.codeplex.com

Pages: [1]   Go Up
Jump to: