• That looks really neat... Maybe you want some feedback if someone specifies an invalid pin mode?

    MCP32x08.prototype.mode=function(pin,mod­e) {
      if (["input","output","input_pullup"].index­Of(mode)<0)
        throw "Pin mode "+mode+" not available";
    

    And if this is a form that you'd copy for other port expanders too, a readPort/writePort (or similar) function that reads/writes all pins at once would be really cool - as I imagine it's something that might often be required.

    Looks great though - it'll be really good to have different types of expander supported.

About

Avatar for Gordon @Gordon started