Added multiple main*.cpp files

master
Drew Bednar 3 years ago
parent 4742d22359
commit 32c620aec6

@ -15,4 +15,8 @@ framework = arduino
monitor_speed = 115200 monitor_speed = 115200
upload_port = /dev/cu.SLAB_USBtoUART upload_port = /dev/cu.SLAB_USBtoUART
debug_tool = esp-prog debug_tool = esp-prog
debug_init_break = tbreak setup debug_init_break = tbreak setup
; I am using src_filter as a cheap way to have multiple main files in one project.
; To use it all you have to do is add the target main file like here we add main3.cpp as out build target:
; src_filter =+<*> -<main*.cpp> +<main3.cpp>
src_filter =+<*> -<main*.cpp> +<main3.cpp>

@ -0,0 +1,24 @@
#include <Arduino.h>
#include <foo.h>
#define LED_BUILTIN 2
int delayTime = 100;
void setup()
{
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
}
void loop()
{
// put your main code here, to run repeatedly:
Serial.println("Starting loop");
digitalWrite(LED_BUILTIN, HIGH);
delay(delayTime);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Turning off LED");
printf("This is main2.cpp!\n");
delay(delayTime);
}

@ -0,0 +1,24 @@
#include <Arduino.h>
#include <foo.h>
#define LED_BUILTIN 2
int delayTime = 1000;
void setup()
{
// put your setup code here, to run once:
pinMode(LED_BUILTIN, OUTPUT);
Serial.begin(115200);
}
void loop()
{
// put your main code here, to run repeatedly:
Serial.println("Starting loop");
digitalWrite(LED_BUILTIN, HIGH);
delay(delayTime);
digitalWrite(LED_BUILTIN, LOW);
Serial.println("Turning off LED");
printf("This is main3.cpp!\n");
delay(delayTime);
}
Loading…
Cancel
Save