Link () opening hundreds of web pages.
in
Integration and Hardware
•
2 years ago
I'm trying to get different RFID cards to open different web pages and have almost got the coding down, apart from the fact that whenever I scan a card, web page upon web page opens, to the point where Processing has to be Force Quit to stop it.
I'm using an ID-12 RFID scanner with an arduino.
Here is my coding - I've tried noLoop(); but it just stops the script doing anything at all...
I'm using an ID-12 RFID scanner with an arduino.
Here is my coding - I've tried noLoop(); but it just stops the script doing anything at all...
- import processing.serial.*;
import cc.arduino.*;
Serial myPort;
String tagID="";
int i;
void setup(){
size (600, 200);
println(Serial.list());
String portnum=Serial.list()[1];
myPort= new Serial(this, portnum, 9600);
myPort.buffer(16);
}
void draw(){
background(0);
println (tagID);
if (tagID.equals("1F001A8850"))
{
for (int i = 1; i < 2; i = i+1)
link("http://mj3989.tumblr.com");
}
else {
if (tagID.equals("1F001A82CF") )
for (int i = 1; i < 2; i = i+1)
link ("http://melaniejnewbould.tumblr.com");
}
}
void serialEvent(Serial myPort){
String inputString= myPort.readString();
tagID = parseString(inputString);
}
String parseString (String thisString) {
String tagString="";
char firstChar =thisString.charAt(0);
char lastChar =thisString.charAt(thisString.length()-1);
if ((firstChar==0x02) && (lastChar ==0x03)){
tagString= thisString.substring(1,11);
}
return tagString;
}
1