English
English
简体中文
日本語

UiFlow Tutorial

UiFlow1 Development Guide

Project Management

Use LTE network

UiFlow1 Blockly

Event

Unit

Unit DAC2

Example

DAC2 (digital to analog Converter) unit to output different analog voltage values

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
Page Tools
PDF
On This Page