This is different from connecting the ESP32 over USB. Here the micro reads a
file from a card and plays it on its own; there the app sends it the signal live
and controls it. See Connect the device.
General notes
1
Copy the file
The exported
.txt goes to the root of the microSD card, under the same name
you declare in the code.2
Wire the reader
Over SPI. Set
SD_CS to the pin you used for CS.3
Declare one pin per channel
In the same order the file columns come out.
4
Set the step time
It comes from the metadata (
STEP_TIME) if you exported it; otherwise you set
it in the code.5
Check the levels
The ESP32 outputs are 3.3 V. If your circuit runs at 5 V you need a level
shifter.
6
For long signals, read in chunks
It is better to stream the card in batches than to load everything into RAM.
The two examples
The help ships two code tabs, with a button to copy:- Digital
- Analog (DAC)
The digital file holds one row per change: the first column is the step
and the rest are each channel value. Between rows the outputs stay as they
are.The example reads row by row, writes the pins and waits until the step of the
next row.