Loading...
Pages: [1]   Go Down
Author Topic: sub-routines HELP  (Read 314 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
Tesla Member
***
Karma: 89
Posts: 6389
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What you need is a C++ tutorial.
Logged

Sydney
Offline Offline
God Member
*****
Karma: 14
Posts: 716
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


Pages: [1]   Go Up
Print
 
Jump to: