Go Down

Topic: subrutine (Read 580 times) previous topic - next topic


How can i call a subrutine,a section of my program is repeatted a lot of time?

Visual Micro

Feb 17, 2012, 11:16 pm Last Edit: Feb 17, 2012, 11:22 pm by Visual Micro Reason: 1
//the loop() function is called by arduino. when it ends it is called again, and again and again...
int i=0;
void loop()
 //call a subroutine
 //and another one

 //or you can make your own looping. we loop 10 times
 int n=0;


void DoSomething()
 //do some stuff here

void DoSomethingElse()
 //do some stuff here

//the code above should add 1 to i and then subtract 1 from i continuously
Arduino for Microsoft Visual Studio Pro and Atmel Studio 6.1 http://www.visualmicro.com
Arduino Debugger http://www.visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx

Morris Dovey

Do you have any programming experience and if so, in what language(s)? This is so basic that it'd help to know at what level to answer...
There's always a better way!


If I recall correctly from many years ago, I think BASIC used the term "subroutine". Beginner questions are okay, we were all beginners once.

Go Up