FreeRTOS

Hi, Im new into FreeRTOS and i’m trying to make circuit using Arduino Mega 2560, Gas sensor, Flame sensor and virtual terminal in Proteus. When i uploaded the sketch , i get the warning message that say “Simulation is not running in real time due to excessive CPU load”. I still get the output in virtual terminal but it came at once after that the output stopped showing up.

Im not sure is it problem with my circuit or code. I hope getting a solution for my problem.
-Thanks

#include <Arduino_FreeRTOS.h>
#include <queue.h>

struct pinRead{
  int pin;
  int value;
};

QueueHandle_t structQueue;

void setup() {
  Serial.begin(9600);
  structQueue = xQueueCreate(10,sizeof(struct pinRead));
  if(structQueue != NULL){
    xTaskCreate(stateFlame, "stateFlame", 128, NULL, 1, NULL );
    xTaskCreate(stateGas, "stateGas", 128, NULL, 1, NULL );
    xTaskCreate(kirimData, "sendData", 128, NULL, 2, NULL );
  }
  vTaskStartScheduler();
}

void loop()
{
}

void stateFlame(void *pvParameters)
{
  (void) pvParameters;

  for (;;)
  {
    struct pinRead currentPinRead;
    currentPinRead.pin = 11;
    currentPinRead.value = digitalRead(11);
    xQueueSend(structQueue, &currentPinRead, portMAX_DELAY);
    Serial.println("Api");
    taskYIELD();
  }
}

void stateGas(void *pvParameters)  
{
  (void) pvParameters;
  
  for (;;)
  {
    struct pinRead currentPinRead;
    currentPinRead.pin = 13;
    currentPinRead.value = digitalRead(13);
    xQueueSend(structQueue, &currentPinRead, portMAX_DELAY);
    Serial.println("Gas");
    taskYIELD();
  }
}

void sendData(void *pvParameters)  
{
  (void) pvParameters;
 
  for (;;)
  {
    int flame = 0;
    int gas = 0;
    struct pinRead currentPinRead;
    if(xQueueReceive(structQueue, &currentPinRead, portMAX_DELAY)== pdPASS)
    {
      Serial.print("Pin: ");
      Serial.print(currentPinRead.pin);
      Serial.print(" Value: ");
      Serial.println(currentPinRead.value);

      if(currentPinRead.pin == 11)
      {
        api = currentPinRead.value;
        Serial.print("Flame: ");
        Serial.println(flame);
      }
       if(currentPinRead.pin == 13)
      {
        gas = currentPinRead.value;
        Serial.print("Gas: ");
        Serial.println(gas);
      }
    }
    taskYIELD();
  }
    
}

(deleted)

FreeRTOS (or any operating system) is surely an unnecessary burden for a 16MHz Arduino Mega.

On an ESP32 which has a lot more memory and processing speed the burden of the OS would be less of an imposition.

…R

It could be that the RTOS overhead is simply too much for the simulation.