├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md └── led_task.ino /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: https://www.buymeacoffee.com/thelastoutpostworkshop 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | .vscode -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 thelastoutpostworkshop 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tasks on ESP32 Made Easy - LED Blinking using Tasks 2 | 3 | Buy Me A Coffee 4 | 5 | 6 | ### Struggling to understand tasks on the ESP32? 7 | 8 | This video breaks down the concepts in a simple, practical way to help you overcome mental roadblocks and take your projects to the next level. Learn how to run multiple components like LEDs, animated GIF, and NeoPixels seamlessly with ESP32 tasks! 9 | 10 | [](https://youtu.be/382p1NT1Wcs) -------------------------------------------------------------------------------- /led_task.ino: -------------------------------------------------------------------------------- 1 | //Youtube tutorial : https://youtu.be/382p1NT1Wcs 2 | #include 3 | 4 | #define LED_1_PIN 5 5 | #define LED_2_PIN 16 6 | #define LED_3_PIN 3 7 | 8 | void setup() { 9 | xTaskCreatePinnedToCore( 10 | led1_sketch, // Task function 11 | "taskName", // Task name 12 | 8192, // Stack size 13 | NULL, // Task input parameters 14 | 1, // Task priority, be carefull when changing this 15 | NULL, // Task handle, add one if you want control over the task (resume or suspend the task) 16 | 0 // Core to run the task on 17 | ); 18 | xTaskCreatePinnedToCore( 19 | led2_sketch, // Task function 20 | "taskName", // Task name 21 | 8192, // Stack size 22 | NULL, // Task input parameters 23 | 1, // Task priority, be carefull when changing this 24 | NULL, // Task handle, add one if you want control over the task (resume or suspend the task) 25 | 1 // Core to run the task on 26 | ); 27 | xTaskCreatePinnedToCore( 28 | led3_sketch, // Task function 29 | "taskName", // Task name 30 | 8192, // Stack size 31 | NULL, // Task input parameters 32 | 1, // Task priority, be carefull when changing this 33 | NULL, // Task handle, add one if you want control over the task (resume or suspend the task) 34 | 1 // Core to run the task on 35 | ); 36 | } 37 | 38 | void led1_sketch(void *parameter) { 39 | // Setup start here 40 | pinMode(LED_1_PIN, OUTPUT); 41 | 42 | // End of your setup 43 | 44 | // Loop function, run repeatedly 45 | for (;;) { 46 | int led = digitalRead(LED_1_PIN); 47 | digitalWrite(LED_1_PIN, !led); 48 | delay(1000); // Allow other tasks to run, adjust as needed 49 | } 50 | } 51 | void led2_sketch(void *parameter) { 52 | // Setup start here 53 | pinMode(LED_2_PIN, OUTPUT); 54 | 55 | // End of your setup 56 | 57 | // Loop function, run repeatedly 58 | for (;;) { 59 | int led = digitalRead(LED_2_PIN); 60 | digitalWrite(LED_2_PIN, !led); 61 | delay(350); // Allow other tasks to run, adjust as needed 62 | } 63 | } 64 | void led3_sketch(void *parameter) { 65 | // Setup start here 66 | pinMode(LED_3_PIN, OUTPUT); 67 | 68 | // End of your setup 69 | 70 | // Loop function, run repeatedly 71 | for (;;) { 72 | int led = digitalRead(LED_3_PIN); 73 | digitalWrite(LED_3_PIN, !led); 74 | delay(50); // Allow other tasks to run, adjust as needed 75 | } 76 | } 77 | 78 | void loop() { 79 | } 80 | --------------------------------------------------------------------------------