Hello everyone, I'm transferring a project from the arduino to the ESP32, is there a command to insert the delayMicroseconds () function as in the arduino?
because it seems to me that delayMicroseconds does not work on esp or am I wrong?
is there something like this for ESP?
help delayMicroseconds() on esp?
Re: help delayMicroseconds() on esp?
Are you using the Arduino platform for ESP32 development? If so, I think `delayMicroseconds()` is available.
Re: help delayMicroseconds() on esp?
delayMicroseconds() works in arduino.
For ESP-IDF, you can use this:
For ESP-IDF, you can use this:
Code: Select all
unsigned long IRAM_ATTR micros()
{
return (unsigned long)(esp_timer_get_time());
}
void IRAM_ATTR delayMicros(uint32_t us)
{
uint32_t m = micros();
if (us)
{
uint32_t e = (m + us);
if (m > e)
{ //overflow
while (micros() > e)
{
NOP();
}
}
while (micros() < e)
{
NOP();
}
}
}
Who is online
Users browsing this forum: No registered users and 14 guests