Steps:
1) Go to https://www.visualmicro.com/, download and install VisualMicro Extension

2) Verify and update the extension from the list

3) Create a new Arduino Project in Visual Studio
Note: Ignore the .ino file that opens right after
Do not delethe the .ino file

4) Expand Solution Explorer and right-click on 'Source Files' then -> Add -> New Item -> c++ File(.cpp)
Name the new file main.cpp - this is mandatory

5) Place the following code into that file
Note - this is a simple blink example to test
Code: Select all
#undef CONFIG_AUTOSTART_ARDUINO
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#define BLINK_GPIO (gpio_num_t)2
extern "C" void app_main()
{
gpio_pad_select_gpio(BLINK_GPIO);
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while (1) {
/* Blink off (output low) */
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(100 / portTICK_PERIOD_MS);
/* Blink on (output high) */
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(100 / portTICK_PERIOD_MS);
}
}

Note: It is probably possible to mix Arduino code with RTOS - needs testing