MCP413X/415X/423X/425X
Max STEPS (128 or 256) and Max Resistance (5, 10, 50, 100 kOhm) depend on model of unit.
STEP 0 = max resistance.
spi
@/spi
MCP413X/415X/423X/425X
Max STEPS (128 or 256) and Max Resistance (5, 10, 50, 100 kOhm) depend on model of unit.
STEP 0 = max resistance.
SPI@/spi
To use the node in your project you should have the xodballxod/digipot-mcp-spi 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
// used for MicroChip Technology MCP413X/415X/423X/425X SPI controlled digitial potentiometers and rheostats
// Reference for Wiring: http://www.learningaboutelectronics.com/Articles/MCP4131-digital-potentiometer-circuit.php
#include <SPI.h>
node {
meta {
// Define our custom type as a pointer on the class instance.
using Type = SPIClass*;
}
SPIClass spi = SPIClass(); // make a reference to SPIClass
void evaluate(Context ctx) {
if (isSettingUp())
spi.begin();
emitValue<output_SPI>(ctx, &spi);
}
}