Try changing:
function SPIwriteOneRegister(regAddress, regValue, spi){ spi.write([0x0A, regAddress, regValue]); }
to
function SPIwriteOneRegister(regAddress, regValue, spi){ spi.write([0x0A, regAddress, regValue], D31); }
... you weren't specifying a 'CS' pin, so the writes likely wouldn't have been working.
Also, if you change:
function SPIreadOneRegister(regAddress, spi){ var d = spi.send([0x0B,regAddress,0x00], D31); return d[2]; }
function SPIreadOneRegister(regAddress, spi){ var d = spi.send([0x0B,regAddress,0x00], D31); print(d); return d[2]; }
Then what sort of things are printed to the console?
@Gordon started
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.
Try changing:
to
... you weren't specifying a 'CS' pin, so the writes likely wouldn't have been working.
Also, if you change:
to
Then what sort of things are printed to the console?