Giter Club home page Giter Club logo

Comments (3)

feilipu avatar feilipu commented on August 12, 2024

The scheduler is not running until after the end of the setup() function. Therefore calling for a task delay via vTaskDelay is meaningless.

Also no tasks have been created, so except for the idle task running the contents of loop() function, your code has no tasks running with any priority.

Suggestion, read the documentation. Follow the examples provided, and you will find it will be easier.

from arduino_freertos_library.

s1913388 avatar s1913388 commented on August 12, 2024

However it runs perfectly with ESP32 in Arduino IDE,

#include <Arduino.h>

void setup()
{
    Serial.begin(9600);
    while (!Serial)
    {
        ;
    }
    Serial.print("Setup and loop task running with priority ");
    Serial.println(uxTaskPriorityGet(NULL));
    vTaskDelay(1000 / portTICK_PERIOD_MS);
    Serial.println("OK");
}

void loop() {}

It gives expected output (with delay of 1000ms):

Setup and loop task running with priority 1
OK

Actually the code is shamelessly copied from the guide Digi-Key

@feilipu I am wondering why "OK" is not printed for the Arduino Mega 2560?

from arduino_freertos_library.

feilipu avatar feilipu commented on August 12, 2024

The ESP32 is a totally different 240MHz / dual core 32-bit thing.
Their IDF uses FreeRTOS to schedule WiFI / Bluetooth activities under the cover.

The "OK" is not printed because the vTaskDelay() function is waiting for an increment that never happens (because the scheduler is not running). Your results will be completely random at that point.

Actually the code is shamelessly copied from the guide Digi-Key.

I suggest to use the examples installed with this library, and available here.

from arduino_freertos_library.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.