We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hi question again
I'm trying to read the rfid tag data for linking something
okay now step is going well
once the data of tag is read , then something happen like link() url which should execute once.
(the reader still capturing)
import processing.serial.*;
Serial myPort; // Create object from Serial class
String dummy;
boolean linkOpened1 = false;
boolean linkOpened2 = false;
void setup()
{
size(200, 200);
background(255);
myPort = new Serial(this, Serial.list()[8], 9600);
dummy=" ";
}
void draw()
{
byte[] inBuffer = new byte[7];
while (myPort.available () > 0) {
inBuffer = myPort.readBytes();
myPort.readBytes(inBuffer);
if (inBuffer != null) {
String myString = new String(inBuffer);
println(myString);
if (!linkOpened1 && myString.equals("187")) {
println("received 187");
link("http://mj3989.tumblr.com");
linkOpened1 = true;
linkOpened2 = false;
}
if (!linkOpened2 && myString.equals("139")) {
println("received 139");
link ("http://melaniejnewbould.tumblr.com");
linkOpened2 = true;
linkOpened1 = false;
}
// if(dummy.equals("187") == false) {
// linkOpened1 = false;
// }
}
}
}
but one small problem is how to reactivate statement
when I try to take tag out of range of reader after calling link()
then get tag inside of range again
Is it possible to repeat calling link() again ?
how to do this any suggestion?
Answers
or when the data is not readable is it possible to execute something like the println() or boolean?
As I wrote in the previous thread, re-set the boolean to false after a number of milliseconds (using millis()) is spent.
Or some other event, like key press or click.