Example: 50-OpenMV-Boards/50-STM32-Boards/50-Board-Control/dac_write.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# DAC Control Example
#
# This example shows how to use the DAC pin output onboard your OpenMV Cam.

import time
from pyb import DAC

dac = DAC("P6")  # Must always be "P6".

while True:
    # The DAC has 8-12 bits of resolution (default 8-bits).
    for i in range(256):
        dac.write(i)
        time.sleep_ms(20)
    for i in range(256):
        dac.write(255 - i)
        time.sleep_ms(20)

results matching ""

    No results matching ""