Skip to content

Commit

Permalink
esp32/quickref.rst: Add DAC example.
Browse files Browse the repository at this point in the history
Signed-off-by: IhorNehrutsa <Ihor.Nehrutsa@gmail.com>
  • Loading branch information
IhorNehrutsa committed Nov 13, 2023
1 parent c140aea commit 48aa74e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion docs/esp32/quickref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
----------------------------------

Expand Down

0 comments on commit 48aa74e

Please sign in to comment.