abort() was called at PC 0x400d9a7f on core 0 Backtrace: 0x4008c7e0:0x3ffbe160 0x4008ca11:0x3ffbe180. n] * 4 ms resp. That means controlling 1 LED with two different delay times. delay () is a blocking function. The best resource to get started from what I've found is the esp-rs book. e. for Variable A : CPU-0 can Write / CPU-1 can READ. 14 4MBflash(80MHz) QFN5*5 3. The ROM function ets_delay_us() (defined in rom/ets_sys. The process is as follows. curr_pos; i<=stepper1. Delay a task until a specified time. You may also use any. You signed in with another tab or window. Although, the producer provides the data continuously, therefore cannot be on hold, meanwhile. ESP32 Arduino and MicroPython both use CONFIG_FREERTOS_HZ=1000. . The closest solution to yours would be to create a semaphore that you attempt to take inside the task with a 100ms delay and that you give from ISR. Re: Task watchdog got triggered. If you don't want to use vTaskDelay maybe you could make the priority of the IDLE and the MAIN task equal. 3V ESP32-D0WD(NRND) Dualcore v1. Don't start and end tasks for each user activity and don't delay them for extended. Currently, the largest value that will produce an accurate delay is 16383; larger values can produce an extremely short delay. 1. This takes some work and code re-organization. One, it keeps us from having to keep checking all the time, freeing up those cycles to do other stuff. I promise this one is definitely about dual core issues and not my crappy array management. 3V ESP32-D0WDQ6(NRND) Dualcore v1. This way the task will block for a maximum of 100ms waiting for semaphore to be given, after which it'll unblock and resume execution anyway. Spoilers below! I highly encourage you to try the challenge on your own before comparing your answer to mine. I have an issue when I try to run everything in a. Make Task2 show the state of Task1. Introduction . xTaskDelayUntil [Task Control] task. 1 seconds to run and the vtaskDelay is set to 2 seconds, that means that the next time this task will be scheduled after 2. @1technophile what i meant by any rtos task which runs without a delay,loop is actually a rtos task which is implemented in esp32 arduino so by just putting it into a loop can solve your problem. See Sleep Modes for these sleep modes and sub sleep modes. 1. I have a esp-wroom-32 module(esp32 dev module) and use arduino IDE, my task is to generate 2 pulses on different pins with as much accuracy as possible: 1) make GPIO_NUM_2 and GPIO_NUM_4 go HIGH 2)Generate single shot pulses on a button press with predefined delay: 2. Timer Initialization¶. esp32-spooky-maze-game - Bare metal Rust implementation of simple game for ESP32. I want to run FreeRTOS on ESP32. Watchdog timer errors for loops for webserver on ESP32. . Down at the very bottom you'll see two core task assignments - one for the stepper loop, one for. For more information and how to add your library to the test see external library testing in the documentation. Steps to execute an interrupt in ESP32. You can check test results in the file LIBRARIES_TEST . they say "waiting for either a temporal or external event" temporal A Task can block itself, and can set a timeout for the block. Among the functions available to it, the following can be highlighted: Scheduled execution every x milliseconds and even microseconds. ESP32. c Yes, it's as bad. This is useful so that your code doesn't block the Device from interfacing with the Blynk Server. The first argument is the name of the function. Hardware: Board: NodeMCU ESP32 Core Installation/update date: xxxx IDE name: Platform. Delay () Postby WiFive » Sun Jul 09, 2017 3:04 am. So, I just put a microsecond loop in like this: unsigned long thedelay; thedelay = micros() + 100; while (micros() < thedelay) {}esp_task_wdt_feed() in the task loop - it didn't help esp_task_wdt_reset() in the task loop - it didn't help esp_task_wdt_deinit() before create the task - it didn't help esp_task_wdt_delete(th) after create the task - it didn't help The only thing that helped to stop WDT is delay(1) instruction, but delay for 1 ms is too much for my purpose . Serial communication that appears. 3V ESP32-D0WDQ6-V3(NRND) Dualcore v3. So your clock processor clock should be > 1 MHZ. () method must return quickly so that the other tasks in the loop get. I try to understand the concept of the dual core operation, but my solutions keep crashing. 1. The RTOS task does not consume any CPU time when it is in the Blocked state. While millis() is an absolute time clock. This is open to a little bit of optimization. Inside the DHT_Oled_task() we will first initialize the I2C interface. To generate a delay, we will use “vTaskDelay. Then when the task wakes up it could check the RTC and delay a little longer as needed. I have disabled all interrupts. See the configuration section for more information. I'm also try to make sense of the information returned by vTaskGetRunTimeStats. What's the reason or how can I get shorter delay when the smallest delay which I can use using assembler "nop" command gives me 0. In my FreeRTOS project, I am using another timer, namely TIM1, therefore using HALDelay() doesn’t give me correct behaviour. h" Inside the loop function, we will add the delay. print ("Starting to create task on core "); Serial. Espressif ESP32 Official Forum. delay(1); also resets WDT timer but I also do not want it be delayed for 1ms. Does SdFat make use of resources that might be affected by SPI interrupts running on a different core? The sd. The task is the piece of code that performs some operation on the board like blinking led, sending temperature, etc. It used to obtain handle or while debugging the task. begin (112500); delay (1000); Serial. Each interrupt has a fixed priority, most (but not all) interrupts are connected to the interrupt matrix. (ESP32 only) // Task to run forever xTaskCreatePinnedToCore( // Use xTaskCreate() in vanilla FreeRTOS toggleLED_2, // Function to be called "Toggle 2", //. Go to Tools > Board and select ESP32 Dev Module. boarchuz is right. After invoking the idle hooks, the idle task puts the CPU into "wait for interrupt state" ("waiti", similar to "wfi" in ARM CPUs). If the counter have not been activated, the currenttime=millis() always ticking. If your application requires that you constantly. Lucianovici commented on Feb 22, 2019. Here the biggest measured delay is 388ms, but I have mesured up to twice that, delays often hits between 200-300ms as seen. Not that an ESP32 dual core tutorial is bad, perhaps overtly advanced for. Example code: void Task1code( void * parameter ){ Serial. println (sensorValue); vTaskDelay ( 1 ); // one tick delay (15ms) in. 追記:プログラム解説 setup内I usually create a lowest priority FreeRTOS task that just loops and calls the feed method with a delay less then the timeout, giving enough time for higher priority "business logic" to run. The first argument is the name of the function. I want it to be 2 seconds regardless of how long the task took to execute. One of the many interesting features of ESP32 is that it has two Tensilica LX6 cores, which we can take advantage of to run our code with higher performance and more versatility. The following optimizations will improve the execution of nearly all code - including boot times, throughput, latency, etc: Set CONFIG_ESPTOOLPY_FLASHFREQ to 80 MHz. First, interrupt handlers need to be defined using the IRAM_ATTR attribute in order to ensure that they're already loaded into instruction memory (IRAM). The other task manages the I2C sensor DHT22; it essentially init the sensor and query it in a infinite loop and print the. Task 2 will run on core 1, receiving data from first task and send it async over TCP. To open the project in a new window, click ‘Yes. INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available. The function below is a task handler, I am trying to init subsystems (SPIFFS, Wire. It simply prints the string to the UART. Once the delay was added the ledc updates worked fine when on core 0, once I moved to core 1 I ran into the issue again. Re: ESP32 2Tasks on 2 Cores - Board reset. The actual time that the task remains blocked depends on the tick rate. Note: Suppose that we have 2 tasks: the low priority task and the high priority task. define a queue, copy, to pass variable A to cpu 1. It now supports 16 ISR-based timers, while consuming only 1 hardware Timer. This library enables you to use Interrupt from Hardware Timers on an ESP32-based board. In this guide, we will show you how to use FreeRTOS timers and delays using ESP32 and ESP-IDF. The following tasks did not reset the watchdog in time: E (17121869) task_wdt: - IDLE0 (CPU 0) E (17121869) task_wdt: Tasks currently running: E. Hello. FreeRTOS Demo_1. You don't need this library for the ESP32 because FreeRTOS is already provided as a component of the ESP-IDF framework of. These tasks are waiting for the key and the low priority task has chance to hold the key then it will block the high priority task and continue executing. Unless it is a linear and very simple program , do not use this. 3 In the callback function of the Timer#1 start Timer #2 with the interval of 1 sec. See the roundrobin. And, I am trying to create a webserver with 3 submit push buttons. Steps to be followed to create a task are: Create a task handle to keep a track of the task created. I started to study FreeRTOS book. delay(1); This will feed the watchdog timer without disabling it. 6/cores/esp32/esp32-hal-misc. here is a task using the ESP32's millis cycle counter and the freeRTOS tick counter. Shizen February 21, 2023, 1:53am 5. delay( 0 ); do not reset WDT timer. It is a signaling process whereby a waiting task is signaled by another task to continue execution. The time is specified in RTOS tick periods. cpp 📋 Copy to clipboard ⇓ Download. That needs 2 µs latency to start the waiting task RTOS_2 in core 0. I have ensured that this is the only task with priority 1. ESP32 LED Blinking Project Overview. But for now, I just observe the input on serial port and work with only one submit bar. The following tasks did not reset the watchdog in time : - IDLE (CPU 0 ) - IDLE (CPU 1 ) Tasks currently running: CPU 0: blinkLedTask CPU 1: ipc1 Task watchdog got. Se estiver utilizando a vTaskDelay, estará evidenciando em seu código a utilização dos recursos do. I would like to use the 2nd core on my ESP32. If you load the BT library the Wi-Fi is on. For example my task execution time may vary from 0. h" #include "freertos/task. CircuitPython uses the asyncio library to support cooperative multitasking in CircuitPython, which includes the async and await language keywords. ESP32 is a series of low cost, low power system on a chip microcontrollers with integrated Wi-Fi and dual-mode Bluetooth. Mode – defines when the interrupt should be triggered. The function timerBegin (uint8_t id, uint16_t prescaler, bool countUp) allows to configure the timer : The ESP32 has 4 independent timers, selected by an id between 0 and 3. This is split into three stages: Port initialization of hardware and basic C runtime environment. Ide: arduino. Now I believe timer interrupt will be a better option as we will not need. Running a number of times or forever. 5. In this guide, we will show you how to use FreeRTOS timers and delays using ESP32 and ESP-IDF. – unalignedmemoryaccess. h" #include "esp_attr. Which makes 'loopDelay' a stupid name 'SerialInterval' is more appropriate. Yes. ’. vTaskList (): This function is used to read the task details (name, state, priority, num). Most modern processors have. But as delay() suspended the controller, in real works, for multiple LED controlling, we use Timers/interrupts to control its On/Off time. The Interrupt Watchdog is responsible for detecting instances where. So, it means that the task will be blocked during the delay time [5] and the scheduler can attribute the CPU to other free task. ’. The I2C interface will be configured by calling the i2c_master_init() function and passing the address of the SSD1306_t structure, SDA pin, SCL pin and Reset pin as parameters inside it. Every 1ms a timer interrupt fires and the scheduler jumps in and looks for the highest priority task that is able run. Go to Firebase and sign in using a Google Account. As soon as this machine starts processing the task from the JSON string of the websocket message, it doesn't take long (5-7 seconds) before the ESP32's watchdog triggers. This is the better option when executing multiple tasks, which is usually the case in FreeRTOS. You want Wi-Fi off, use the ESP32's API, see post#5, and turn off Wi-Fi. 1 Demo - In this demo, we create 2 tasks: low priority task and high priority task. The device sends data via mqtt every 1. Esp32 crashing using FreeRTOS tasks. lib_deps = feilipu/FreeRTOS @ 10. M5stackはCPU:ESP32を内臓しており、マルチタスク処理に対応している。 M5stackでマルチタスク処理を行う。 方法. task1 will print the strings "task1. It’s scheduled to run after 120 milliseconds when run the first time. attachInterrupt(GPIOPin, ISR, Mode); This function accepts three arguments: GPIOPin – sets the GPIO pin as the interrupt pin, which tells ESP32 which pin to monitor. Core 0. Hi everyone. Click on the File menu on the top menu bar. 14 — QFN6*6 1. This function. Good afternoon, I want to make a continuously operable gateway that measures temperature with esp32. The ROM function ets_delay_us() (defined in rom/ets_sys. 以下の動画を. h" #include "freertos/task. This means that the motor has a step angle of 5. If I change CircuitPython to use CONFIG_FREERTOS_HZ=1000, the 10ms delay also. If bot. Re: ESP32 CPU load % display without special configuration. Down at the very bottom you'll see two core task. The task which runs setup () and loop () is created on core 1 with priority 1. Internally, esp_timer uses a 64-bit hardware timer. The Arduino Core for the ESP32 runs over the ESP-IDF (Espressif IoT Development Framework). Sometimes my ESP32 looses. CONFIG_ESP_MAIN_TASK. Why would running loop() {} add a 2mS delay in running the analogRead task? That's when freeRTOS is doing clean up tasks. @Whandall perhaps you can help out making this ESP32 task example more indicative of what ESP32 can do. ESP-IDF is the official development framework for the ESP32, ESP32-S, ESP32-C, ESP32-H and ESP32-P Series SoCs. (Note: don't forget to call this function, or it will lead to the watchdog restarting the ESP32). If you use external libraries in your code. Application startup covers everything that happens after the app starts executing and before the app_main function starts running inside the main task. For example delayMicroseconds(2) takes 330 cycles, corresponding to a delay of more than 4µs, or double what was requested, when running at 80MHz to save power. Click Get Started, and then Add project to create a new project. Re: FreeRTOS Task notification crashing esp32. The concrete device is an ESP32-CAM and it is running at 80MHz at approx 25°C room temperature. c and Task. My device uses wifi, ble feature. After you have uploaded your code to the development board, press its ENABLE button. Raising the level, the interrupt handler can reduce the timer processing delay. The ESP32 chip has 3 UART controllers (also referred to as port), each featuring an identical set of registers to simplify programming and for more flexibility. I want it to be 2 seconds regardless of how long the task took to execute. Serial. 61 *C T=74. Optimizing execution speed is a key element of software performance. It Seems that when use Task1 on Core 0 That First line gets thrown to the end. The pdMS_TO_TICKS () macro can be used to convert a time specified in. begin (112500); delay (1000); Serial. h. For example, we have two tasks: Demo_Task and Demo_Task2. tool-cmake. cpp 📋 Copy to clipboard ⇓ Download. Note1: As a workaround in the code I reset the device with MQTT, Ethernet and ESP. xTaskCreate () for first task. It then returns to the main task without disturbing that task in any way though the main task may well check at the appropriate point for a "flag" set by the interrupt. loop() is just a task. xTaskCreatePinnedToCore (task1, "Task1", 2048, NULL, 1, &task1_handle, 1); xTaskCreatePinnedToCore (task2,. Hi, I´m using a vTaskDelay right now to suspend my task for a while, but not being able to unblock before time runs up is a problem. vTaskDelay (2000 / portTICK_PERIOD_MS); The RTOS tick period is (by default) 10ms. August 15, 2022. I also tried putting those two functions (or whatever they are called after. Among the functions available to it, the following can be highlighted: Scheduled execution every x milliseconds and even microseconds. I need task2 also to receive the 2 char arrays sent to the queue by task1. 0000041666666666667 ms per clock tick. If we look at the esp-idf documentation about ESP32 WDT we can see that ESP32 comes with an interrupt watchdog and a task watchdog timer api. Put your current code from gpio_isr_handler () in a task in an infinite loop with a , start the task in app_main () and have gpio_isr_handler () just wake the task. Your code is quite reasonably divided into two threads (Task1 and Task2) which run on different cores. The exact hardware timer implementation used will depend on the target, where LAC timer is used for ESP32. h BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement ); INCLUDE_xTaskDelayUntil must be defined as 1 for this function to be available. More knowledgeable programmers usually avoid the use of delay () for timing of events longer than 10’s of milliseconds unless the Arduino sketch is very simple. Manage FreeRTOS tasks - Suspend, Delay, Resume, Delete. Thank you for a good reply. continuous loop). So I know the stepper_task is not hanging. The esp_intr_alloc () abstraction exists to hide all these. Tasks Management such as Task priority setting, task suspension, task deletion, and Task delay; Tasks Synchronization with Gatekeeper Tasks, Semaphore, and Mutex; Timing measurement hook; Run time Tracing hooks;. I really don't understand why when I'm change the task from core 1 to core 0. This function can be used by periodic tasks to ensure a constant execution frequency. delayMicroseconds() calls it at least twice. The hello_task. Here is what you need to do to install the ESP32 boards into the Arduino IDE: Open the Arduino IDE. The new “C3” variant has a single 160 MHz RISC-V core that out-performs the ESP8266, and at the same time includes most of the peripheral set of an ESP32. #2. void loop() { delay(1000); } The task functions. The output contains both the task-read value and the in-line value. ESP32 Arduino and MicroPython both use CONFIG_FREERTOS_HZ=1000. Both of your tasks are running at full steam ahead with no controls. 1. Tasks are meant to be long-running, because they are relatively heavyweight. Connect to Bluetooth Client (my phone) 3. いずれも、Arduino IDEを利用しているが、ウォッチドッグタイマーはマイコン依存の部分が多々あり、低レベルではそれぞれ異なるFunctionが用いられて. And at the same time, be an. You do not have the required permissions to view the files attached to this post. for Variable B : CPU-1 can Write / CPU-0 can READ. g. begin(); You can use the setTimeOffset () method to adjust the time for your timezone in seconds. If the Resumed task has higher priority than the running task then it will preempt the running task or else stays in ready state. print("Task1 running on core. Identifying the GPIO used as a wake up source. The esp32 has WiFi and ESP-NOW active at the same time, receiving some data from another esp32. The watchdog monitor task runs at a higher priority than the tasks it is monitoring. print("Task1 running on core "); Serial. 05s and I want. Thus the turn off delay is a multiple (n>=2) of those period times and actual turning off takes place approx [(n-1). Note that this behavior is the expected since the implementation of the ESP32 for the Arduino delay uses the FreeRTOS vTaskDelay function, as can be seen here. To say it works is really stretching it. To save power when the CPU is idle (no task is running), the "automatic light sleep" / "tickless idle" options have to be enabled in the project config. esp_timer set of APIs provides one-shot and periodic timers, microsecond time resolution, and 64-bit range. This must not be confused with a human time scale of tens or hundreds of milliseconds or indeed, a couple. Add one (increment) the notification value. The following are confirmed to be working: All lighting and lighting telegram messages. Multitasking with asyncio. Thank you for your quick reply. In the main. The objective of this post is to give an introduction to FreeRTOS queues, using the ESP32 and the Arduino core. Chuck. I am new to ESP32 programming, coming from Arduino, and I am struggling with the task watchdog timer. Which means the freeRTOS task switcher will swap to another task during the delay, non-blocking. This leads to the second tangentially related problem. Also run each test at least twice, to detect nondeterministic/random effects. ESP32 有個先進武器 - 雙核多工,現在有機會派上用場了。 用 xTaskCreatePinnedToCore() 建立一個獨立 Task,在 Task 跑無窮迴圈 delay(1) 1ms analogRead() 取樣一次,循環記錄 100 個點。Since my task takes approximately 0. The failure seemed to take place when the in-line reading was taking place. For example my task execution time may vary from 0. Here is the actual circuit connected on a breadboard as per the circuit diagram. ISR – is the name of the function that will be called each time the interrupt occurs. ESP32. h BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement ); INCLUDE_xTaskDelayUntil must be defined as 1 for this function to be available. Step 2: If i put the Oled and NTP code in the main loop function, all is well. is there a more complicated example out there? I am trying to figure out how I want to start coding my project where there are 9 "tasks" and I want to utilize both cores efficiently. This number corresponds to the tick which is the frequency of the chip. ). Device Description. The delay has to be configurable to sub microsecond resolution. The nature of the tasksHello, My question is about implementing the functionality of HALDelay(), which is implemented based on the SysTick timer tick count. More precisely the ip5306 version that has been discontinued. The HTTP server runs normally, but "crashes", page times out. The value was 100. This is the core functionality of a kernel. delay(1); also resets WDT timer but I also do not want it be delayed for 1ms. In my opinion you should just disable the task watchdog. If you want the task to be cancellable in the queue but do not want to check the cancellation token nor throw an exception yourself, you need to use the approximated code with a cancellation token. Shizen: I can use vTaskDelay () for days on a task and the ESP32 will handle the timing. The yield() function transfers control to the ESP8266, NOT the scheduler. Espressif ESP32 Official Forum. 本範例主要是針對Arduino (ESP32)單晶片使用單核心情況下,往往因為delay指令,讓程式在執行過程中產生暫停或卡住,須等delay的時間過後,主程式才能繼續進行。. For the ESP-IDF board, we have chosen the custom board option. Let us now assume that 1/C is faster than the delay you want to wait. On the ESP32, this is the APB_CLK clock, clocked at 80 MHz. Using delay on a ESP32 whiles using freeRTOS is a waste of CPU time. Main Task (main) Task that simply calls app_main. I wanted to try to do multi tasking usigng the duel core system on the ESP32, Iam able to make it run on Core 0 but not core 1. For ESP-IDF target, we have chosen ESP32 module. When the Global variable is set by the BLE task (Task2) the Timer_turn on task (Task3 has to run). In the past I've played around a little with Rust and long before I put together a few little projects with ESP32 controllers using the Arduino libraries. The Print stream is configured to the UART0 of the ESP32. The problem occurs in the next line, the first vTaskDelay call. Connect and share knowledge within a single location that is structured and easy to search. You should use it if you are using arduino, and. As mentioned before, we will use the xTaskCreatePinnedToCore function. The scheduler can stop, suspend, and resume individual tasks. This. In app_main we are creating a freeRTOS task to blink LED at 1 sec delay. delay() doesn't actually block the CPU at all. timeClient. So, it means that the task will be blocked during the delay time [5] and the scheduler can attribute the CPU to other free task. If xSemaphoreTake() is used, the actual file download of slows down, acts erratically, and very often doesn't complete, allowing enough time for the watchdog to kick in and reboot the device. This indicates the amount of memory we want to reserve for the particular task. The function below is a task handler, I am trying to init subsystems (SPIFFS, Wire. Now I can use different vTaskDelay in the app_main function. esp_task_wdt_init(WDT_TIMEOUT, true); // enable panic so ESP32 restarts esp_task_wdt_add(NULL); // add current thread to WDT watch And this in the loop() part:. Delay in uS. 8V/3. 2. At the bottom of the function you will see various lines that are commented. Hi, My understanding is (I am new to this myself) that LOOP in your sketch is running as a task, when you issue the command "xTaskCreate" this then creates a second task (anotherTask) which starts running along side LOOP (so you then effectively have two programs running at the same time on the esp32). Low uS delays will not be easy in software because another task/ISR might cut across you. • Priorities can range from 0 to N. On ESP32, micros() takes about 150 cycles. h. The Interrupt Watchdog is responsible for detecting instances where. Set one or more bits in the notification value. When Demo_Task finishes a particular job on a data, it gives out a flag (Semaphore) which is an integer and increases by 1. The ROM function ets_delay_us() (defined in rom/ets_sys. Specify the project name and directory. After that, you can use vTaskDelay (. It should be much faster. For your WDT issue, I think it's better to change the priority of WDT task to be higher than that of the task you're monitoring. A tick is what you configure it to be. Using "nop" command gives me 0. Begin () called within setup assigns SPI interrupts to core 1 (Arduino) whereas the tasks may be trying to use resources on core 0. As a computer programmer implementing logic, you don’t want your tasks to get delayed for any reason. h. You need to make sure it's already there. @me-no-dev @1technophile @akshar001 UPDATE 1: The warning disappear when I put these three. The NodeMCU ESP32 is based on the Xtensa 32-bit LX6 dual-core microprocessor that embeds the FreeRTOS OS. ESP32 Timer Example (Arduino) Let’s say we’d like to toggle an LED every 1 ms without using a delay that blocks the CPU and does much harm to the overall timing performance of your system. My attempt at the code looks like this: ESP32CoreTaskTest_Class. Running a number of times or forever. System initialization of software services and FreeRTOS. This means our application has 2 tasks: ESP32 task will print the text “this is ESP32 task” and the second task will print “this is another. Below you can find my Tasks. The buffer size should be minimum. esp_timer set of APIs provides one-shot and periodic timers, microsecond time resolution, and 64-bit range. Using Arduino Programming Questions. All other side functions should run non-time critical in the other core. This. h" #include "esp_attr. Official development framework for ESP32 chip. h" #include "freertos/task. The esp_intr_alloc () abstraction exists to hide all these. lib_deps = feilipu/FreeRTOS @ 10. I've run into a problem recently when working on a new project involving an ESP32 and a max43421e (USB Host). TaskScheduler. When an interrupt occurs, the microcontroller will go through the following steps: The microcontroller will halt the current task and will store the address of the next instruction (Program Counter or PC) on the stack (lower byte first). LED controlling is mostly the easiest task for a controller, that we control the LED On/Off by digitalWrite() and delay() to control its On/Off time when we begin to learn to program.