pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

DAC2

案例程序

from m5stack import *
from m5ui import *
from uiflow import *
import time
import unit

setScreenColor(0x222222)
dac2_0 = unit.get(unit.DAC2, unit.PORTA)

i = None

while True:
  for i in range(4):
    dac2_0.setVoltage(i, channel=dac2_0.CHANNEL_0)
    print((str(str(i)) + str('V')))
    wait(1)
  wait_ms(2)

功能说明

dac2_0.setDACOutputVoltageRange(dac2_0.RANGE_5V)
  • 设置 DAC 的电压
    • 范围(5V)
    • 范围(10V)
dac2_0.setVoltage(5, channel=dac2_0.CHANNEL_0)
  • 设置指定通道的输出电压
dac2_0.setVoltageBoth(5, 5)
  • 设置通道0和通道1的输出电压
On This Page