pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

DAC

Example

Output waveforms at pin 25 using the dac0 channel

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)

API

dac0 = machine.DAC([pin])
  • Setting the conversion channel
dac0.write(255)
  • Write DAC conversion value
dac0.beep(1800, 200, 0)
  • Configure the outputs to drive the buzzer frequency, time and amplitude.
dac0.waveform(1800, dac0.SINE, duration=200, scale=0, offset=0, invert=0)
  • Setting the output waveform frequency amplitude offset
dac0.stopwave()
  • Stop Output
dac0.freq(1800)
  • Setting the output frequency
On This Page