uSeconds?

idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

uSeconds?

Postby idahowalker » Wed Jan 09, 2019 3:48 pm

As part of a complementary filter for a MPU unit I am using micros() to get the time passed; using millis() returns a zero. More out of wanting to know how to do it, and actually do it, if it is possible, is there a way. A more ESP32ish way to get a microsecond count then using micros()?

boarchuz
Posts: 559
Joined: Tue Aug 21, 2018 5:28 am

Re: uSeconds?

Postby boarchuz » Wed Jan 09, 2019 4:17 pm

You can see the micros() function here:

https://github.com/espressif/arduino-es ... isc.c#L104

So you can use (unsigned long) (esp_timer_get_time() / 1000) if that is ESP32ish enough for you. But then, you may as well just use micros() since that's kinda the point of all this...

idahowalker
Posts: 166
Joined: Wed Aug 01, 2018 12:06 pm

Re: uSeconds?

Postby idahowalker » Wed Jan 09, 2019 4:40 pm

@ boarchuz, thanks for that info.

I also found that ESP.getCycleCount() will work as well.

Who is online

Users browsing this forum: No registered users and 51 guests