• Unfortunately that doesn't seem to work for me. On Espruino 1.58, the following code example works:

    function onInit() {
      digitalWrite(LED3,0); //reset blue LED
      I2C1.setup({scl:B6, sda:B7});
    }
    
    onInit();
    
    var nfc = require("PN532").connect(I2C1);
    print(nfc.getVersion());
    nfc.SAMConfig(); // start listening
    
    setInterval(function() {
      nfc.findCards(function(card) {
        print("Found card "+card);
        card = JSON.stringify(card);
        if (card=="[4,238,254,40,117,69,0]") digitalWrite(LED3,1);
      });
    }, 1000);
    

    If I unwrap the onInit() function so the I2C1.setup() is run inline at the start, as soon as I type save() the Espruino reboots and I get the I2C errors. And every time it starts up after that.

    It does seem to set it up though:

    >dump()
    var nfc = {
      "i2c":{
        "_options":{"scl":B6,"sda":B7}
      }
    };
    I2C1.setup({"scl":B6,"sda":B7});
    digitalWrite(B6,0);
    pinMode(B6,"opendrain");
    digitalWrite(B7,0);
    pinMode(B7,"opendrain");
    
About

Avatar for thomc @thomc started