NRC received events ( NRF.on('NFCrx') )

Posted on
  • I'm using Puck.js (Espruino v2.01) and I want to be able to manipulate variables based on data that is written to the NFC tag using NFCrx.
    If I use the 'NFCon' event, and console log based on that, everything works when I scan NFC:

    >NRF.on('NFCon', () => { console.log("test"); });
    =undefined
    test
    test
    test
    

    But when I use the NFCrx event instead, after NFCStart of course, the event callback is not called (almost as if the event is not registered):

    >NRF.nfcStart();
    =new Uint8Array([95, 193, 71, 81, 42, 138, 1, 165, 4, 3]).buffer
    >NRF.on('NFCrx', (rx) => { console.log(rx); });
    =undefined
    >NRF.on('NFCrx', (rx) => { NRF.nfcSend("test"); });
    =undefined
    >NRF.on('NFCrx', (rx) => { console.log("test"); });
    =undefined
    

    What am I missing?
    Thanks in advance

  • That's odd - I guess you could try using nfcStop first just in case NFC was already set up?

    Personally I haven't used it but this module does:

    Do you could use that as a reference?

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

NRC received events ( NRF.on('NFCrx') )

Posted by Avatar for user94249 @user94249

Actions