pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

DAC2

Example

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)

API

dac2_0.setDACOutputVoltageRange(dac2_0.RANGE_5V)
  • Set the voltage of the DAC
    • Range (5V)
    • Range (10V)
dac2_0.setVoltage(5, channel=dac2_0.CHANNEL_0)
  • Sets the output voltage for a specified channel
dac2_0.setVoltageBoth(5, 5)
  • Set the output voltage for channels 0 and 1
On This Page