ESP32 write to DAC very long (slow)


Simple test:

import dac

pinMode(D2, OUTPUT)
my_dac = dac.DAC(D25.DAC)

while True:


digitalWrite(D2, HIGH)


digitalWrite(D2, LOW)

If you run this code, the LED flashes at a frequency of 1 second. Which makes the use of DAC completely useless.


However, if you write “my_dac.write(255,0,0)” the speed works fine.

Perhaps it is necessary to specify in the documentation?


Thanks for pointing that out, We will be working on the documentation of the DAC to illustrate that.


Hi @trawen

I’ve taken a deeper look and there seems to be a little issue with the esp32 DAC code: could you try to open the vhal_dac.c file under ZERYNTH_INSTALLATION/dist/r2.1.2/vhal/xtensa-lx6/esp32 (where ZERYNTH_INSTALLATION is C:\Users\USERNAME\zerynth2 under Windows and /home/USERNAME/.zerynth2 under GNU/Linux and Mac) and place under


the following line:

if (i == len-1) break;

We will fix officially with the next patch.
Let me know :slight_smile: