I have a small project involving an NFC/RFID Shield (Seeedstudio), an Arduino UNO and two reed sensors. I want to do some action af there the first reed sensor is activated, then scan the RFID tag and then check the second reed sensor. The reed sensors are connected with a pull-down resistor for each of them and like one would normally do to deal with the floating inputs issue.
For some reason the PN532 is blocking the other sensors (on digitlInputs). I see the second sensor but that seems to be because I just read the RFID, the other way around is troublesome (I need to wait quite long and then the first reed sensor is detected)...
If I uncomment nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A) then the reed sensors work very well.
I was thinking that I could probably use a work around that sets some register to high, and will leave it high till I write a low to it or something like that, because I think the problem is that the Arduino is too busy to detect the HIGH event because the hardware works well.
Update:
I'm actually thinking of using a SR-latch so that I will be able to detect a high, then reset the latch and wait for another detection.
jopiek:
I have ordered some CD4043 latches. Will cost me an extra pin (to reset the thing), but wel at least remember the state of my sensor I hope!
Hi, Simulating a CD4043 Latching Switch on an MC.
You know, I've thought of this for ages but can't figure out how to do one part of the conundrum on an MC.
However the rudiments are dead simple, so here is a short form:
1] Primarily - make LOW [Switch off] all outputs: to and for experimental reasons lets use, yes you have guessed it 4 LED's as proof.
2] Press one of the 4 switches.
3] Recognise which switch has been depressed, debounce and switch on [make HIGH] that particular LED circuit and set the output HIGH.
4] wait for another or the same switch to be pressed go HIGH or LOW and repeat forever.
Sounds simple, and I am sure it is but my problem comes when I try to sort out debounce and which switch is being pressed and heceforth tested where quite frankly I get lost.
Both the CD4043 (a brilliant logic switch) only provides up-to say, and I am guessing, 50 mA, so you may need to use a transistor to provide power for other than a simple led or logic output. Without getting the books out I actually can't remeber what the output is from the CD4043 as it's output is governed by the common Vcc., input which I think can go to 15 V or so. I use it often on 12V Vcc circuits for throwing points, semaphor, aspects and what have you on model train circuits where you can put it in circuit with a CDU., or momentary switch and that one momentary instance of power does the trick for all through a CD4043. But get it on a MC..............................................now that would be................................MAGIC