pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

DAC

案例程序

使用dac0通道在25引脚输出波形

from m5stack import *
from m5ui import *
from uiflow import *
import machine
import time

setScreenColor(0x222222)

dac0 = machine.DAC(26)
while True:
  dac0.write(0)
  wait(1)
  dac0.write(255)
  wait(1)
  wait_ms(2)

功能说明

dac0 = machine.DAC([pin])
  • 设置转换通道
dac0.write(255)
  • 写入DAC转换值
dac0.beep(1800, 200, 0)
  • 配置输出驱动蜂鸣器频率,时间和振幅
dac0.waveform(1800, dac0.SINE, duration=200, scale=0, offset=0, invert=0)
  • 设置输出波形频率振幅偏移量
dac0.stopwave()
  • 停止输出
dac0.freq(1800)
  • 设置输出频率
On This Page