DAC Unit
The Dac2 class interfaces with a GP8413 15-bit Digital to Analog Converter (DAC), capable of converting digital signals into two channels of analog voltage output, ranging from 0-5V and 0-10V.
Support the following products:
Micropython Example:
import os, sys, io
import M5
from M5 import *
import time
from unit import DACUnit
i2c = I2C(0, scl=Pin(1), sda=Pin(2), freq=400000)
dac2_0 = DACUnit(i2c0, 0x59)
dac2_0.setDACOutputVoltageRange(dac2_0.RANGE_10V)
dac2_0.setVoltage(7.5, channel=dac2_0.CHANNEL_BOTH)
UIFLOW2 Example:
class DACUnit
Constructors
Methods
- DACUnit.get_value() int
Get the current value of the DAC.
- Returns:
The DAC value as a 16-bit unsigned value.
UIFLOW2:
- DACUnit.get_voltage() float
Get the current voltage of the DAC.
- Returns:
The DAC voltage as a float.
UIFLOW2:
- DACUnit.set_value(value: int) None
Set the value of the DAC.
- Parameters:
value – The DAC value as a 16-bit unsigned value.
UIFLOW2:
- DACUnit.set_voltage(voltage: float) None
Set the voltage of the DAC.
- Parameters:
voltage – The DAC voltage as a float. The voltage must be between 0 and 3.3V.
UIFLOW2:
- DACUnit.get_raw_value() int
Get the raw value of the DAC.
- Returns:
The raw DAC value as a 12-bit unsigned value.
UIFLOW2:
- DACUnit.set_raw_value(value: int) None
Set the raw value of the DAC.
- Parameters:
value – The raw DAC value as a 12-bit unsigned value.
UIFLOW2:
- DACUnit.get_normalized_value() float
Get the normalized value of the DAC.
- Returns:
The normalized DAC value as a float.
UIFLOW2:
