potentiostat-mcp4725-device

antoniorrg/program-potentiostat/potentiostat-mcp4725-device

No description
potentiostat-mcp4725-device
@/potentiostat-mcp4725-device
ADDRbyte
Indicate the address of the MCP4725 device (set to 0x62 by default).
potentiostat-mcp4725-device
OUT
ADDR
OUT@/potentiostat-mcp4725-device
To use the node in your project you should have the antoniorrg/program-potentiostat library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD require https://github.com/adafruit/Adafruit_MCP4725

#include <Wire.h>
#include <Adafruit_MCP4725.h>

node {

    meta {
    // Define our custom type as a pointer on the class instance.
    using Type = Adafruit_MCP4725*;
    }

    // Create an object of class Adafruit_TSL2591
    Adafruit_MCP4725 dac = Adafruit_MCP4725();

        
    // Internal state variables defined at this level persists across evaluations
    Number foo;
    uint8_t bar = 5;

    void evaluate(Context ctx) {
        bar += 42;

        if (isSettingUp()) {
            // This run once
            foo = (Number)(bar + 1);
        }

        
        auto ADDR = getValue<input_ADDR>(ctx);
        
        dac.begin(ADDR);
        
        
        emitValue<output_OUT>(ctx, &dac);
        
        
    }
}