How can I run multiple sketch on one stetch an Arduino

I should write a program, however,
/////////////////////////////////////////////////
sketch1
void setup() {

}

void loop() {

}
////////////////////////////
sketch2
void setup() {

}

void loop() {

}
//////////////////////////
sketch3
void setup() {

}

void loop() {

}

No, you cannot do it like that. You can however look at the three individual programs and think about how to write one program that does all three things.

Delta_G:
No, you cannot do it like that. You can however look at the three individual programs and think about how to write one program that does all three things.

///////////////////////////////////////////////////////////////////////////////
namespace aGroup {
setup() {
// Code
}

loop() {
// Code
}
}

namespace bGroup {
setup() {
// Code
}

loop() {
/

setup() {
if(conditionIsTrue) {
aGroup::setup();
} else {
bGroup::setup();
}
}

loop() {
if(conditionIsTrue) {
aGroup::loop();
} else {
bGroup::loop();
}
}

/ Code
}
}
///////////////////////////////////////////////////////////

I tried this and can not do

If you tell us exactly what you want to achieve we may be able to help

SamIAm93:
If you tell us exactly what you want to achieve we may be able to help

///////////////////////////////////

I want to combine multiple applications into a single application.

Yes, you said that. An arduino can only have one setup function and one loop function, but if you post the code that you want to combine we may be able to help you achieve it

Maybe you want to read this:-
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

You could do this. Although it might not work in your particular application if any of the functions involve blocking code.

void setup1(){}

void setup2(){}

void setup3(){}

void loop1(){}

void loop2(){}

void loop3(){}

void setup(){

   setup1();
   setup2();
   setup3();
}

void loop(){
  
   loop1();
   loop2();
   loop3();
}

But you have to be very careful to avoid any blocking code in any of the loop functions. That means millis checks instead of delay and no long for or while loops waiting for something slow to happen.

Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.

Grumpy_Mike:
Please read this:-
How to use this forum
Because your post is breaking the rules about posting code.

did not mean to
I'm sorry

How would you know more than one is running?

-jim lee

Thanks everyone
I try to see all the way I have way more to offer me any.

Delta_G:
You could do this. Although it might not work in your particular application if any of the functions involve blocking code.

void setup1(){}

void setup2(){}

void setup3(){}

void loop1(){}

void loop2(){}

void loop3(){}

void setup(){

setup1();
  setup2();
  setup3();
}

void loop(){
 
  loop1();
  loop2();
  loop3();
}





But you have to be very careful to avoid any blocking code in any of the loop functions. That means millis checks instead of delay and no long for or while loops waiting for something slow to happen.

///////////////////////////////////////
int j=0;
void setup1(){}

void setup2(){}

void setup3(){}

void loop1(){}

void loop2(){}

void loop3(){}

void setup(){
Serial.begin(9600);
if(j=0) {
Serial.print("111 ");
setup1();
}

setup2();
setup3();
}

void loop(){
if( j=0 ){
Serial.print("111 ");
loop1();
}

loop2();
loop3();
}/////////////
It can display 111.(Serial.print("111 "); )

tee1:
did not mean to
I'm sorry

So why are you doing it again? If you are not capable of understanding how to post code yo are not capable of understanding the answer to your problem and everyone is wasting ther time here.

Read reply #6 again.