Closed dderg closed 9 months ago
Seems like this code is executed, but not necessary for this board:
#if defined(ESP_H) && defined(ARDUINO_ARCH_ESP32)
__attribute__((weak)) void analogWrite(uint8_t pin, int value){ };
#endif
I have run SimpleFOC on the ESP32 Nano with the latest framework versions.
be aware that when using the Nano ESP32 it uses Arduino PIN numbers, which is unusual in my experience, normally you work with the ESP32 gpio numbers.
the SimpleFOC code has a bug with respect to this, meaning you have to use the gpio numbers of the pins when initializing BLDCDriver.
i have not yet tested current sensing.
to get rid of the compile error please use the dev branch of SimpleFOC or wait for the next release…
I had fixed it like this:
// if the mcu doen't have defiend analogWrite
#if defined(ESP_H) && defined(ARDUINO_ARCH_ESP32) && !defined(analogWrite)
__attribute__((weak)) void analogWrite(uint8_t pin, int value){ };
#endif
I have committed this to the dev branch of SimpleFOC, please let me know if it works for you.
I think you can still use GPIO pins, you just need to define them as GPIOx. I will give it a try, thank you!
It works, but for interrupts to work I had to remove digitalPinToInterrupt, it was returning an integer and then attachInterrupt was confusing it with another pin number, at least that's what I think was happening.
Arduino nano ESP32 has ESP32-S3 chip, so it seems like it should be supported, but I get the following error, looks like the library doesn't know what board it is: