Page 1 of 1

uSeconds?

Posted: Wed Jan 09, 2019 3:48 pm
by idahowalker
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()?

Re: uSeconds?

Posted: Wed Jan 09, 2019 4:17 pm
by boarchuz
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...

Re: uSeconds?

Posted: Wed Jan 09, 2019 4:40 pm
by idahowalker
@ boarchuz, thanks for that info.

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