You are reading a single comment by @DrAzzy and its replies. Click here to read the full conversation.
  • 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(SP­I2,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!

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v69 Copyright 2014 G.Williams
    >echo(0);
    =undefined
    >digipot.getVal(0);
    =0
    >fs.readdir("");
    =[
          "BlackBerry",
          ".Trash-1000",
          "dash"
        ]
    >digipot.getVal(0);
    =319 
    > 
    
    

    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/EspruinoD­ocs/blob/master/devices/MCP4xxxSPI.js

About

Avatar for DrAzzy @DrAzzy started