-
• #2
The idea is that out of the box, NFC points to
puck-js.com
to get you started - however if you reset Puck.js withreset()
that removes the in-built NFC URL.To add your own, just do
NRC.nfcURL("http://my.url.com")
: http://www.espruino.com/Reference#l_NRF_nfcURLOr are you saying that even after a reset you can't get an NFC URL that you defined to work?
-
• #3
Basically a combination of the two, I use the following code:
var isLightOn = false; NRF.nfcURL("https://www.google.com"); NRF.on('NFCon', function() { LED1.write(true);}); NRF.on('NFCoff', function() { LED1.write(false);}); setWatch(function() { isLightOn = !isLightOn; LED2.write(isLightOn); }, BTN, { repeat:true, edge:"rising", debounce:50 });
And when I first hard reset the device it works on my Nexus 6P. If I wait, say, 15 minutes and try again, it no longer works (although the button press does.)
-
• #4
Are you absolutely sure about that? Please could someone else confirm?
There's nothing inside Puck.js's software that should have that effect - and I've had NFC stay working after days of activity.
-
• #5
I have two pucks so I can confirm on a second one when I get home. I've tried on both an Android 6P and an LG g4 and both have the same behavior.
I'll start running some tests right now to see if I can figure out when exactly the NFC starts giving out. I'll also check my second puck when I get home.
-
• #6
Figured out the bug -- or maybe it's as planned and I just missed that part in the docs, but the issue happens when you are disconnected from the web ide. Here are my steps to reproduce:
- Upload code above to puck via Web IDE
- Try NFC (it should work)
- Click the top left button in the Web IDE, disconnecting the puck
- Try NFC (it should not work)
- Reconnect to the Web IDE
- Try NFC (it should now work again)
Not sure if this is intended or what, but seems odd to me.
- Upload code above to puck via Web IDE
-
• #7
I tried on my new Puck running 1v88 and the NFC works ok even after disconnecting the Puck from the Web IDE. Copy-pasted the code above and tested on an LG G4 phone.
-
• #9
Circling back around on this, after playing with the pucks a few more days it seems like all the problems are resolved. I have no idea what was going on, but I'll update if I figure it out. Thanks for the help guys!
-
• #10
I am also having some issues with NFC. I got 2 pucks. On one the NFC URL works just fine. The other stopped working after a few hours of fooling around with it. For example, if write something like:
NRF.nfcURL('https://www.google.com');
and upload to both pucks, it works fine on one and not on the other. That said, I can not get the following code to work on either of my pucks:
NRF.on('NFCon', function() { digitalPulse(LED1, 1, 250); });
I was hoping to use NFC to be able to tap one puck on the other and pass some information. I have tried resetting the troublesome puck, but haven't had any luck. All other functions tested on the pucks have worked fine so far (bluetooth, mag, temp, etc.)
-
• #11
Have you tried with an up to date firmware? I just did:
NRF.nfcURL('https://www.google.com'); NRF.on('NFCon', function() { digitalPulse(LED1, 1, 250); });
And the red LED flashes as expected.
Could you try forcing NFC off on the troublesome one with just a
NRF.nfcURL();
without arguments, then turning it back on? Or totally disconnecting the battery then reconnecting with the button held down for ~4 seconds might help. -
• #12
I also just looked into NFC and I had similar observations as @trezm. I configured a NFC url, which worked fine the first time, but then even after closing my android devices browser or using a totally different device, it did not work any more. What works is taking out the battery and configuring the url again.
I assume the NRF.nfcURL() is not one-shot, eg. it does not clear itself after it has been used. I have the latest firmware 1.91 btw.
thx
Sven -
• #13
OK, it's really a bit weird. Things first started working again, but then again did not. I've now written some small interval that changes the URL every 5 seconds, I was able to get the first url transferred to my mobile via NFC, but then nothing else worked. But I still see the log outputs in the espruine web console.
var url = "https://api.yaas.io/bullseye/"; var counter = 0; setInterval(function() { NRF.nfcURL(url + counter++); console.log(url + counter); }, 5000);
-
• #14
What about:
NRF.on('NFCon', function() { digitalPulse(LED1, 1, 250); });
This would show if the other device was starting to communicate via NFC. If it is, I would imagine that most likely it's something on the reader that's causing issues.
Also: changing the NFC URL will reset the NFC - so if you do it every 5 seconds then you may well reset the NFC while the other device is trying to read it.
You could respond to NFCon/NFCoff events and make sure you don't change the URL while NFC is on
-
• #15
thx, I will try this once I have some time. makes total sense.
I just received my pucks yesterday (love the build quality and feel btw,) and am having some problems with the NFC. Here are my current running details;
It's looking like NFC works directly after a hard reset (i.e. taking the battery out, holding down the button, reinserting the battery and holding for 3 seconds.) After a few minutes, however, it stops working. Even resetting/reuploading the code via the IDE does not work.
Any ideas?