2
\$\begingroup\$

As I am learning ESP32 I found that many Arduino libraries and sample code run on ESP32. That confuses me. Is ESP32 a variation of Arduino? Is there any article that I can read and learn more about this compatibility and how some of Arduino libraries and sample code run on ESP32?

\$\endgroup\$
3
  • \$\begingroup\$ There seems to be some misunderstanding somewhere. Can you please give us the links to your ESP32 module and Arduino libraries? \$\endgroup\$
    – tlfong01
    Commented Sep 8, 2022 at 4:48
  • \$\begingroup\$ "Arduino" is primarily software, not hardware. the Arduino company designed and sells some hardware, but that is not the main thing \$\endgroup\$
    – Juraj
    Commented Sep 8, 2022 at 6:10
  • \$\begingroup\$ A MCU is a "microcontroller" of any kind. "Just" change low-level routines. Same high level "commands". \$\endgroup\$
    – Antonio51
    Commented Sep 8, 2022 at 9:48

1 Answer 1

9
\$\begingroup\$

Arduino encompases three main items:

  1. The IDE you run on your PC
  2. The libraries and core code that runs on the microcontroller.
  3. a range of circuit boards of which the Arduino Uno is the most common.

People may talk about the Arduino ‘language’ but in reality is is C++ and the ‘language’ is a collection of code libraries so that functions like ‘digitalWrite’ behave similarly on different hardware. That is Arduino in a nutshell.

The esp32,esp8266 and many others have Arduino support in the IDE and in the libraries. Since these micros have WiFi, there are libraries that support this functionality.

Other libraries for peripheral chips like the BME280 can work across many platforms due to the standardisation of the base Arduino functions.

Some people dismiss Arduino as kiddy stuff and that it glosses over a lot of the low level details. Yes, it hides the ‘evil’. For me, I can choose a micro that has Arduino support and be up and running in minutes. Even if I just rely on the startup code, there’s nothing to say I must use digitalWrite vs direct register access.

Do I really want to write my own I2C driver just so I can claim to be bare metal? Sure, I can do this if necessary, but if the Arduino supplied one does the job, then that’s one less thing I need to worry about.

\$\endgroup\$
4
  • \$\begingroup\$ More specifically, Arduino is a cross-platform SDK and ecosystem. That SDK handles initialisation of the device, provides functions like digitalWrite() and delay(), and executes your setup() and loop() functions. Each target microcontroller and board is supported using an Arduino core, which is an implementation of the Arduino SDK for that platform and a board definition that tells the Arduino IDE how to compile the code for the target board. There's an AVR core for Arduino Uno, Nano, Mega, etc., there's an ARM core for Due, and there are also ESP8266 and ESP32 cores. \$\endgroup\$
    – Polynomial
    Commented Sep 8, 2022 at 15:21
  • \$\begingroup\$ People who dismiss Arduino as kiddy stuff have apparently never tried to set up a "proper" microcontroller programmer! They are universally very painful to work with. \$\endgroup\$ Commented Sep 8, 2022 at 17:46
  • \$\begingroup\$ Thanks for help. Being able to use Arduino libraries with ESP32 is suriel. They have different architectures. I couldn't believe it until I did it myself !!!! \$\endgroup\$
    – Allan Xu
    Commented Sep 8, 2022 at 20:21
  • 1
    \$\begingroup\$ Arduino is architecture agnostic. I use it on AVR, Cortex M0,3,4,7 , RiscV and ESP (xtensa). I use Platformio as it gives me all the benefits of the Arduino ecosystem with a much better editor -Visual Studio Code. The word you wanted was ‘surreal’! \$\endgroup\$
    – Kartman
    Commented Sep 8, 2022 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.