-
• #2
Nice - and that's all that's needed? No setup code or anything?
You could actually simplify the code a bit further, because you can take advantage of the fact that
I2C.writeTo
takes bytes (so effectively does&0xFF
for you).var voltage = 4095; voltage = E.clip(voltage,0,4095); // MCP4725 expects a 12bit data stream in two bytes (right aligned) I2C1.setup({scl:b6, sda:b7, bitrate:100000}); I2C1.writeTo(0x60,[voltage >> 8,voltage]);
It might be worth turning this into a module? It'd be tiny, but would at least make using the MCP4725 really easy for anyone who didn't want to worry about I2C commands.
Hi just to say got a MCP4725 - DAC working (thanks to some Python code form johnwhittington) on the Pico. I'm using Sparkfun module but Ada Fruit do one too.
https://www.sparkfun.com/products/12918?_ga=1.22340158.462334063.1427963564