Avatar for user89762

user89762

Member since May 2018 • Last active May 2018
  • 1 conversations
  • 6 comments

Most recent activity

    • 5 comments
    • 81 views
  • in Puck.js, Pixl.js and MDBT42
    Avatar for user89762

    It worked writing my cs pin in write(), thank you very much!!

  • in Puck.js, Pixl.js and MDBT42
    Avatar for user89762

    It still doesn't work

  • Avatar for user89762

    I just started working on puck.js and I'm trying to get data from my ADXL362 connected to it, but my code always returns me zeros or 255, here it is:

    var spi = new SPI();
    
    spi.setup({mosi:D29, miso:D30, sck:D28});
    
    var x;
    var y;
    var z;
    
    function SPIreadOneRegister(regAddress, spi){
        var d = spi.send([0x0B,regAddress,0x00], D31);
        return d[1];
    }
    
    function SPIwriteOneRegister(regAddress, regValue, spi){
        spi.write([0x0A, regAddress, regValue]);
    }
    
    function beginMeasure(spi) {
        var temp = SPIreadOneRegister(0x2D, spi);
    
        console.log(  "Reg 2D before = " + temp);
    
        var tempWrite = temp | 0x02;
        SPIwriteOneRegister(0x2D, tempWrite, spi);
        setTimeout(function() {
          temp = SPIreadOneRegister(0x2D, spi);
          console.log(  "Reg 2D after = " + temp);
        }, 10);
    }
    
    function readXData(spi){
        var XDATA = SPIreadOneRegister(0x08, spi);
        console.log("XDATA = " + XDATA);
        return XDATA;
    }
    
    function readYData(spi){
        var YDATA = SPIreadOneRegister(0x09, spi);
        console.log("\tYDATA = " + YDATA);
        return YDATA;
    }
    
    function readZData(spi){
        var ZDATA = SPIreadOneRegister(0x0A, spi);
        console.log("\tZDATA = " + ZDATA);
        return ZDATA;
    }
    
    SPIwriteOneRegister(0x1F, 0x52, spi);
    beginMeasure(spi);
    
    
    x = readXData(spi);
    y = readYData(spi);
    z = readZData(spi);
    console.log("*");
    

    If you have any solution please tell me.

Actions