Arduino libraries

Volker
Posts: 2
Joined: Thu May 30, 2019 1:49 pm

Arduino libraries

Postby Volker » Thu May 30, 2019 1:55 pm

Hi!
I'am new at ESP32, i would like to know if the libraries from arduino sensors, and the code, works the same on ESP32 or its needed some changes?

Thanks in advance.

gpezzella
Posts: 50
Joined: Sun Jan 27, 2019 8:04 pm

Re: Arduino libraries

Postby gpezzella » Thu May 30, 2019 3:57 pm

hi
libraries work almost in the same manner if not are been used internal hardware parts like timer, watchdog ecc

Volker
Posts: 2
Joined: Thu May 30, 2019 1:49 pm

Re: Arduino libraries

Postby Volker » Thu May 30, 2019 4:27 pm

gpezzella wrote:
Thu May 30, 2019 3:57 pm
hi
libraries work almost in the same manner if not are been used internal hardware parts like timer, watchdog ecc
Very nice to know that. Thanks! :D

espNooB0xFF
Posts: 3
Joined: Wed Jul 03, 2019 4:06 pm

Re: Arduino libraries

Postby espNooB0xFF » Thu Jul 04, 2019 1:28 am

Hi. So far I have found very little difference from the libs I've used (generally standard stuff / SD etc) but there are a few things that can be confusing if and when you go to use them.

For example..
If you want to set the PWM on an LED / output then you first need to set the frequency, channel and resolution as well as the pin number:

Code: Select all

int freq = 5000;		
int ledChannel = 0;		
int resolution = 8;		
int LED = **enter your pin here**
Also you may need to include other libraries or globals etc before they will work, but generally things seem to be well documented. I've found that best practice is to use the ESP32 specific library that was ported from the arduino version, as this has been reworked to work specifically on the ESP32. The repo should contain everything you need to know, but you can always check the keywords and work back from here.

That said, there are a few things that you just can not do as of yet, but depending on how far you are attempting to go you may or may not stumble over these.

If you ever need to access or run something that isn't yet ported, there is the ESP-IDF which isn't too complicated to learn or use if you are already able to code within the arduino IDE.

I don't tend to like windows builds so I run everything from a virtual machine and then compile from there.
The menuConfig system is really good, and adds a lot of extra power / access to the initial setup / functionality. However, I tend to do a majority of coding in the arduino IDE as that is quicker for me, and on the most part contains everything I need.

That's my take on this, I am still learning at an intermediate level but thought I would post as I started from the arduino environment and worked my way up through various controllers until they released this amazing SoC!

Best of luck on your travels and I hope that helps in some way!

Who is online

Users browsing this forum: No registered users and 59 guests