Please see all COVID-19 updates here as some shipments may be delayed due to CDC safety and staffing guidelines. If you have an order or shipping question please refer to our Customer Support page. For technical questions please check out our Forums. Thank you for your continued support.


Member Since: August 22, 2011

Country: United States

  • I know there's an esp8266 port for rtos (expressif,mattcallow) but does anyone know if it's been made into an Arduino Library like the avr and amd versions here? Is anyone working on that?

  • Watson, I think I get it. Mind blown. It's like there are threads now on an Arduino and somehow, magically, they all have stacks. Wow. How is that done? I suppose the whole rest of of the program after vTaskStartScheduler() is a series of interupts that schedule more interrupts but I'm still working on how a single cpu stack is managed to do that. Greatest hack ever my vote you have. This means that kids can write simple controllers to run stepper motors in a coordinate way. Robot time. But, I must ask. Will it run two tasks on an Uno R3? 4 tasks?

  • I'm taking this as a lesson where it's good to read the sparkfun blogs. Because, I wrote this a couple of days ago! So, yea, everyone, read sparkfun. Btw, I think I know a better trick for when the millis() timer rolls over. The trick is to never comare two times with each other but to, instead, subtract first and then compare with zero. Here's my version:

        // An example of two things running at different times.
        // This would be the .h file.
        #ifndef WootTimedItem_H_
        #define WootTimedItem_H_
        class WootTimedItem {
            long interval = 1000L * 60 * 10;// 10 min is default
            unsigned long nextEvent = 0;
            WootTimedItem( long _interval ) {
              interval = _interval;
              nextEvent = millis() + interval;
            virtual void setup() = 0;
            virtual void work() = 0;
            // call this from the arduino loop()
            void main_loop(unsigned long currentTime);
        // this would go in the .cpp file
        void WootTimedItem::main_loop(unsigned long currentTime) {
          long delta = nextEvent - currentTime;// now it's signed!
          if ( delta < 0 ) {
            nextEvent += interval;
        // examples: classes should override setup() and work()
        // blink pin 13 led
        class Blinker : public WootTimedItem {
            int  pin =  13;
            char state = LOW;
            Blinker( long interval, int pin ): WootTimedItem(interval) {
              this->pin = pin;
            void setup() {
              pinMode(pin, OUTPUT);
            void work() {
              if ( state == LOW ) {
                digitalWrite(pin, HIGH);
                state = HIGH;
              } else {
                digitalWrite(pin, LOW);
                state = LOW;
        // print a message
        class Printer : public WootTimedItem {
            char * msg = "";
            Printer( long interval, char * msg ): WootTimedItem(interval) {
              this->msg = msg;
            void setup() {
            void work() {
        // test it out
        Blinker blinker(500, 13);
        Printer msg(1900, "its alive!");
        void setup() {
          // put your setup code here, to run once:
        void loop() {
          // put your main code here, to run repeatedly:
          // it should just be the main_loop's
          long now = millis();

No public wish lists :(