summaryrefslogtreecommitdiff
path: root/docs/esp32/quickref.rst
diff options
context:
space:
mode:
authorIhor Nehrutsa <Ihor.Nehrutsa@gmail.com>2023-11-13 12:06:42 +0200
committerDamien George <damien@micropython.org>2023-12-11 12:58:22 +1100
commite423b3c0ba09d7f8b1b9081e2edb520455aaad33 (patch)
tree7cb41596b0c6f2e7fc56dae0303b837f82814d7e /docs/esp32/quickref.rst
parent495be71d56337a7b162b4fe97d4407d97f87d9f0 (diff)
docs/esp32/quickref: Add DAC example.
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
Diffstat (limited to 'docs/esp32/quickref.rst')
-rw-r--r--docs/esp32/quickref.rst15
1 files changed, 14 insertions, 1 deletions
diff --git a/docs/esp32/quickref.rst b/docs/esp32/quickref.rst
index e03a5ffbc..08df25b05 100644
--- a/docs/esp32/quickref.rst
+++ b/docs/esp32/quickref.rst
@@ -141,7 +141,7 @@ These are working configurations for LAN interfaces of popular boards::
# Olimex ESP32-GATEWAY: power controlled by Pin(5)
# Olimex ESP32 PoE and ESP32-PoE ISO: power controlled by Pin(12)
- lan = network.LAN(mdc=machine.Pin(23), mdio=machine.Pin(18), power=machine.Pin(5),
+ lan = network.LAN(mdc=machine.Pin(23), mdio=machine.Pin(18), power=machine.Pin(5),
phy_type=network.PHY_LAN8720, phy_addr=0,
ref_clk=machine.Pin(17), ref_clk_mode=machine.Pin.OUT)
@@ -330,6 +330,19 @@ possible at the same frequency.
See more examples in the :ref:`esp32_pwm` tutorial.
+DAC (digital to analog conversion)
+----------------------------------
+
+On the ESP32, DAC functionality is available on pins 25, 26.
+On the ESP32S2, DAC functionality is available on pins 17, 18.
+
+Use the DAC::
+
+ from machine import DAC, Pin
+
+ dac = DAC(Pin(25)) # create an DAC object acting on a pin
+ dac.write(128) # set a raw analog value in the range 0-255, 50% now
+
ADC (analog to digital conversion)
----------------------------------