Program FlowsProgram FlowsPooling
Interrupt Driven
CombinationHandling ConcurrencyRTOS
PoolingBasic Structurevoid Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}Poolingvoid Setup()
{
// Initialization code goes here
Initialization();
}
void Loop()
{
// Your code goes here
if(Peripheral_A)
{
ProcessA();
}
if(Peripheral_B)
{
ProcessB();
}
if(Peripheral_C)
{
ProcessC();
}
}Interrupt DrivenBasic Structurevoid Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}Interrupt Drivenvoid Setup()
{
// Initialization code goes here
Initialization();
}
void Loop()
{
// Empty. Things are done in Interrupts
}
void ISR(Routine_A)
{
ProcessA();
}
void ISR(Routine_B)
{
ProcessB();
}
void ISR(Routine_C)
{
ProcessC();
}CombinationBasic Structurevoid Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}Combinationvolatile char isr_flag_a = 0;
void Setup()
{
// Initialization code goes here
Initialization();
}
void Loop()
{
// Your code goes here
if(isr_flag_a == 1)
{
isr_flag_a = 0; // Clear Flag
Process_A();
}
}
void ISR(Routine_A)
{
isr_flag_a = 1;
}RTOSBasic Structurevoid Setup()
{
// Initialization code goes here
}
void Loop()
{
// Your code goes here
}RTOS#include <Arduino_FreeRTOS.h>
/* Additional Variables will be declared here... */
void Setup()
{
// Initialization code goes here
xTaskCreate(Task_A); // Note: abstract representation
}
void Loop()
{
// Empty. Things are done in Tasks
}
void Task_A()
{
// your code goes here...
}