openmv/scripts/examples/Arduino/Portenta-H7/02-Board-Control/dac_write.py
2021-01-31 16:34:01 +02:00

18 lines
395 B
Python

# 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)