EmbDev.net

Forum: µC & Digital Electronics Programming the ESP32 with the Arduino IDE


von Cliff W. (cliff)


Rate this post
useful
not useful
The code programmed for the ESP32 by using the Arduino IDE can be used 
directly on the Arduino UNO?
I read a weather station article that was done with ESP32 but compiled 
with Arduino IDE, I have an Arduino UNO board, can I just copy the code 
from this project?

https://www.instructables.com/STONE-HMI-ESP32-Weather-Station/

von Lothar M. (lkmiller) (Moderator)


Rate this post
useful
not useful
Cliff W. wrote:
> can I just copy the code from this project?
Lets say: you have fuel (code) for a big truck (ESP32) and you fill this 
fuel in a small moped (Nano). Will the moped (due to the same fuel) be 
able to handle the same load as the truck?

> can I just copy the code from this project?
Maybe, as long as the code does not use specific hardware of the ESP32.
But after a short glance at the description of the Project: No it will 
not run on the Nano.

But: why don't you simply try it?

: Edited by Moderator
von stefanus (Guest)


Rate this post
useful
not useful
Cliff W. wrote:
> The code programmed for the ESP32 by using the Arduino IDE can be used
> directly on the Arduino UNO?

Usually not. There are many differences to consider:

- 8 versus 32 bit
- 16 versus 240 Mhz CPU clock
- 2 kB RAM versus 320 kB RAM
- Some ESP32 have two cores plus an ULP processor, the Arduino UNO has 
only one
- The ESP32 has an operating system, the Arduino UNO does not
- The ESP32 comes with many libraries that the Arduino UNO does not have

A simple LED blinker program might be portable with 0 effort, but no 
regular application.

In general you cannot simply replace a Board by another one with a CPU 
of a totally different architecture. The Arduino Framework is not able 
to abstract the hardware so much.

von fop (Guest)


Rate this post
useful
not useful
I can't find the complete ESP code on that site.

You can compile that for UNO, if
- the code doesn't use libraries that aren't available for the UNO (like 
Wifi or WebServer)
- the code doesn't need more ram or flash space than an UNO can provide
- the code uses library functions instead of accessing sfrs directly

After that be aware, that the ESP is a 3.3V chip. UNO has 5V at its 
i/os.

von Cliff W. (cliff)


Rate this post
useful
not useful
>> can I just copy the code from this project?
> Maybe, as long as the code does not use specific hardware of the ESP32.
> But after a short glance at the description of the Project: No it will
> not run on the Nano.
>
> But: why don't you simply try it?

Yes, I tried it and there were some problems and I am trying to fix 
them. I am still completing the code because it is incomplete.

von Cliff W. (cliff)


Rate this post
useful
not useful
> Usually not. There are many differences to consider:


I also found the problem that there are some library files that I don't 
have, and I need to fill these library files.

von Cliff W. (cliff)


Rate this post
useful
not useful
> You can compile that for UNO, if
> - the code doesn't use libraries that aren't available for the UNO (like
> Wifi or WebServer)
> After that be aware, that the ESP is a 3.3V chip. UNO has 5V at its
> i/os.

Thanks for the suggestion, fortunately the required library file is not 
wifi but temperature sensor library file.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig