> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oryx.mechatronstudio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate the signal with an ESP32

> Reading the exported file from a microSD card, with the example the app ships.

This is the help that opens from the question mark in the export window. The
exported file is read from a **microSD card**, and the app ships an example to
get started.

<Note>
  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](/en/device/connect).
</Note>

## General notes

<Steps>
  <Step title="Copy the file">
    The exported `.txt` goes to the root of the microSD card, under the same name
    you declare in the code.
  </Step>

  <Step title="Wire the reader">
    Over SPI. Set `SD_CS` to the pin you used for CS.
  </Step>

  <Step title="Declare one pin per channel">
    In the same order the file columns come out.
  </Step>

  <Step title="Set the step time">
    It comes from the metadata (`STEP_TIME`) if you exported it; otherwise you set
    it in the code.
  </Step>

  <Step title="Check the levels">
    The ESP32 outputs are **3.3 V**. If your circuit runs at 5 V you need a level
    shifter.
  </Step>

  <Step title="For long signals, read in chunks">
    It is better to stream the card in batches than to load everything into RAM.
  </Step>
</Steps>

## The two examples

The help ships two code tabs, with a button to copy:

<Tabs>
  <Tab title="Digital">
    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.
  </Tab>

  <Tab title="Analog (DAC)">
    The analog file describes **segments**: each row is a whole segment —from
    which step to which step, on which channel, between which levels and with
    what curve— and the rows are ordered by the step they start at.

    Each row stands on its own, so it can be played back **one line at a time**.

    The last column is the **corner radius**: how much to round the break with the
    next segment on that same channel, taking half a curve from each side. With
    `-` or `0` the break stays sharp.

    <Warning>
      The ESP32 DAC is **8-bit** (0–255) and tops out near 3.3 V. If you exported at
      a higher resolution, you have to rescale.
    </Warning>
  </Tab>
</Tabs>

## Alternative: the complete firmware

If instead of writing the player you would rather use the one that already
exists, the project ships a **complete sketch** that receives the signal over USB
from the app and plays it, with control over start, stop, voltage, step time and
RPM.

See [ESP32 firmware](/en/device/firmware).
