(Not Implemented) MCP413X/415X/423X/425X
Max STEPS (128 or 256) and Max Resistance (5, 10, 50, 100 kOhm)
digipot-class
@/digipot-class
(Not Implemented) MCP413X/415X/423X/425X
Max STEPS (128 or 256) and Max Resistance (5, 10, 50, 100 kOhm)
CSport
bits8boolean
MOhmnumber
POT@/digipot-class
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
node {
meta {
using Type = Number;
}
//auto MOhm = 10;
// auto bits = 8;
// auto CS = 10;
// auto maxStep = 128;
void evaluate(Context ctx) {
if (isSettingUp()){
static_assert(isValidDigitalPort(constant_input_CS), "must be a valid digital port");
::pinMode(constant_input_CS, OUTPUT); // set pinmode output for Chip Select;
Type digipot = getValue<input_CS>;
digipot.Mohm = getValue<input_MOhm>(ctx);
digipot.maxStep = getValue<input_bits8> ? 255 : 128;
}
emitValue<output_POT>(ctx, digipot);
}
}