You won’t be able to do anything with a response from processing, because that requires a loop, eg, listen for tag, send to processing, wait for processing to reply, do something, then listen for tag.
Hi John, I think what Jenny wants to do is:
- listen for tag, (this will block but there is nothing else to do)
- send to processing
- wait for processing to reply
- light some LEDs
- loop back to listen for a tag
Adding hardware to receive the RFID input would be more robust, but more complicated and expensive then perhaps it needs to be. I would think this app should work with SoftwareSerial as long as a second RFID tag did not come in and out of proximity while waiting for and handling the response to the previous one.
Am I missing something?
Software serial hangs until there’s serial data, so if the program isn’t needed for anything else, then yes it can sit there and wait for a tag, and then run through a sequence, and then return and wait for another tag.
The problem with that, is if there is no tag, then the program hangs. So, if you wanted LEDs turned off after a certain amount of time, then it won’t / can’t process that request, until serial data becomes available.
The simplest explanation, is the blinking LED example code won’t work when software serial is hung up waiting for serial data, time virtually stands still, or “gets put on hold” for choice of better words. Any miscellaneous functions based on time, or counters, or external events like processing deciding its time to tell the board to turn all the LEDs off, simply will not work.
There is no serial.available function for ss and that’s the core of the problem. Serial available lets you check for serial data, and if there is none, then the controller can go away and do something else, as you’d expect, otherwise… it’s almost not worth using one.
Personally I’ve spent about 3+ months trying to solve the software serial problem, actually not solve it, but work through various hacks and improvisations … and spent a small fortune in the process. Eventually, I ended up with a wiring board, but then decided to have a peek at the Lilypads because they’re so incredibly inexpensive. Coincidentally, I’m working with RFID modules, and processing, software serial was a serious sticky point until the Lilypad I2C, they cost less than 20 bucks, and give you about as much power as wiring board, minus the copious numbers of A/D’s and the “very” generous 128k