ivanseidel / ArduinoThread

⏳ A simple way to run Threads on Arduino
MIT License
951 stars 195 forks source link

Incompatible with ESP32 #30

Open SciLor opened 6 years ago

SciLor commented 6 years ago

The library seems not to work on the ESP32. Boards: https://github.com/espressif/arduino-esp32

I always get "error: 'Thread' has not been declared" Using the ESP8266 boards it works fine

SciLor commented 6 years ago

See https://github.com/SciLor/ESP8266_Hyperion_LED-Controller/issues/34

ivanseidel commented 6 years ago

Can you please check #include <Thread.h> is the first included file from the library, and that it is indeed included?

Also, please post the code here so we can understand better.

(Luckily, yesterday I was using a ESP32... but did not use it with ArduinoThread)

SciLor commented 6 years ago

The code is here: https://github.com/SciLor/ESP8266_Hyperion_LED-Controller/blob/develop/HyperionRGB/EnhancedThread.h

You can reproduce the problem easily: Create a new Arduino Sketch. Create an EnhancedThread.cpp with:

#include "EnhancedThread.h"
void EnhancedThread::run() {
  Thread::run();
}

and EnhancedThread.h

#include <Thread.h>
class EnhancedThread : public Thread {
  public:
    void
      run(void);
};

Select the Wemos LOLIN32 or ESP32 Devboard as device. Compile - error

Known workarounds: Copy the ArduinoThread lib into the projects folder or combine the h+cpp file into one file.

Use Arduino / ESP8266 and it works fine.

ivanseidel commented 6 years ago

Try including Thread.h and ThreadController.h in your main file. That shouls work

On Mon, Apr 30, 2018, 3:58 PM SciLor notifications@github.com wrote:

The code is here:

https://github.com/SciLor/ESP8266_Hyperion_LED-Controller/blob/develop/HyperionRGB/EnhancedThread.h

You can reproduce the problem easily: Create a new Arduino Sketch. Create an EnhancedThread.cpp with:

include "EnhancedThread.h"

void EnhancedThread::run() { Thread::run(); }

and EnhancedThread.h

include

class EnhancedThread : public Thread { public: void run(void); };

Select the Wemos LOLIN32 or ESP32 Devboard as device. Compile - error

Known workarounds: Copy the ArduinoThread lib into the projects folder or combine the h+cpp file into one file.

Use Arduino / ESP8266 and it works fine.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ivanseidel/ArduinoThread/issues/30#issuecomment-385495483, or mute the thread https://github.com/notifications/unsubscribe-auth/AC9Vr21Ckyd0hB-7vSUTdN4_4bttTB_Yks5tt17dgaJpZM4RVsA1 .

SciLor commented 6 years ago

I have added #include in the other 2 files without success. The error stays the same.

phoax commented 6 years ago

I'm testing this lib with a standard ESP32 and Visual Code. It works fine.

SciLor commented 6 years ago

I am using the Arduino Software

phoax commented 6 years ago

This example is not working for you ? https://github.com/ivanseidel/ArduinoThread/blob/master/examples/SimpleThread/SimpleThread.ino

patrickelectric commented 6 years ago

I'm using this library with ESP32 without any problem. For nodemcu and wimos.