Loading files
701e58161This file is pinned to the selected release. Download the original to open it in your design tool.
701e58161This file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/tulipcc-498083946.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
# driver for the m5stack DAC (DAC1, not DAC2)
# import m5dac
# m5dac.set(volts) # 0-3.3V
from machine import Pin, I2C
i2c = I2C(0, freq=400000)
def set(volts):
value = int((volts / 3.3)*4095)
if(value>4095): value=4095
if(value<0): value = 0
b0 = 0x40
b1 = int(value/16)
b2 = int((value % 16) << 4)
i2c.writeto(0x60, bytes([b0,b1,b2]))