Closed derfeger9000 closed 4 years ago
You would be best placed addressing this to nfcpy which is the python library which handles the nfc interaction
I didn’t put this correctly :)
Im not an experienced programmer, im just trying to create a great music box for the kids.
I think the issue is with the python script, as I am not good in python...
After the last line where you wait for the on-connect event and call your function if you catch it, I copied your line, put it directly under yours and replaced on-connect with on-release, calling my new function if I catch it.
There are no errors, but it just never catches the on-release event it seems, so nothing happens when I remove the tag.
If you say this is the right place to put this line, I will go to nfcpy and will check with them, but I thought I’d ask here first :)
Many thanks
I found my mistake:
after line 178 i added the following:
reader.connect(rdwr={'on-release': released})
but this is not how the call works. When 'on-connect' is caught, the while loop stops at line 178, once the tag is removed it continues the loop.
so i simply called my function after line 178 that will pause the playback in the room
This way i can put a tag on an once its removed the music will stop
This can probably be implemented more elegantly, but it will do for now ;)
I am planning let my released function check if the new tag is the same tag that played last time and just continue, the behaviour common in childrens music boxes like toniebox - any ideas welcome :)
Hi Mark,
i have added a new function "release" that is called when the NFC Tag is released from the reader. This way i wanted to pause playback when the tag is removed. I am having trouble calling the on-release function from the reader it seems, as i cannot get it to work.
Would you be able to help?
Thanks Marius