I've been going through hell using SPI to communicate with a digital potentiometer.
Check this out:
I send this to Espruino:
SPI2.setup({scl:B13,miso:B14,mosi:B15});
digitalWrite(C4,1);
var digipot=require("MCP4xxxSPI").connect(SPI2,C4,1,128);
so digipot.getVal(0) should return 319 (actual value is 63, but it's adding 256 to it due to a bug in my module code - not accounting for differences between parts). Look what happens!
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I've been going through hell using SPI to communicate with a digital potentiometer.
Check this out:
I send this to Espruino:
so digipot.getVal(0) should return 319 (actual value is 63, but it's adding 256 to it due to a bug in my module code - not accounting for differences between parts). Look what happens!
I have had it in failing state for hours, then one file system access, and bam, it's fixed.
Module code is here:
https://github.com/SpenceKonde/EspruinoDocs/blob/master/devices/MCP4xxxSPI.js