openmv/scripts/examples/50-Arduino-Boards/Portenta-H7/50-Board-Control/dac_write.py
iabdalkader 98a29e0870 scripts/examples: Update examples.
- Add examples index.
- Remove RP2040's Bluetooth examples.
- Resort examples.
2023-10-29 21:21:55 +01:00

22 lines
560 B
Python

# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# 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)