I'm porting an Uno project to the ESP32. It compiles and runs fine as an Uno project but throws lots of errors when I try to compile it for the EPS32. I'm addressing these one by one, from the top of the list down, until I can get the sketch to compile.
I'm currently scratching my head over things like this:
ePaper_CFAP122250A00213.cpp:27:34: error: 'digitalRead' was not declared in this scope
while(0 != digitalRead(EPD_BUSY));
ePaper_CFAP122250A00213.cpp:16:45: error: 'LOW' was not declared in this scope
#define ePaper_CS_0 (digitalWrite(EPD_CS, LOW))
ePaper_CFAP122250A00213.cpp:16:48: error: 'digitalWrite' was not declared in this scope
#define ePaper_CS_0 (digitalWrite(EPD_CS, LOW))
At the risk of stating the obvious, here's what's odd about these errors (there are many more just like them):
- As I said before, this stuff compiles fine for the Uno.
- Why should standard Arduino key words like digitalWrite, LOW, and HIGH be unrecognized "in this scope?"
- Why are the last two errors being called out in #define statements? I thought the compiler just does a dumb search-and-replace for those, then evaluates the line where they appear. Shouldn't that be where the error gets thrown?
- I have digitalWrite, LOW, and HIGH in my .ino and they don't throw any errors.
- The standard Blink example sketch has digitalWrite, LOW, and HIGH in it and compiles and executes fine on my h/w.
Can this have something to do with the .cpp library file (I've confirmed it's in the same folder as the other files in this project)? Compatibility between C++ and ESP32? Any thoughts appreciated.