
312 MAKING THINGS TALK
The sketch shown here
is a modification of the
Parallax sketch, with a new method,
parseString(). It reads the entire string,
confirms that the start and end bytes
are there, and strips out all but the
ten-byte tag ID. The changes to the
previous sketch are shown in blue:
/*
ID Innovations RFID Reader
language: Processing
*/
// import the serial library:
import processing.serial.*;
Serial myPort; // the serial port you're using
String tagID = ""; // the string for the tag ID
void setup() {
size(600,200);
// list all the serial ports:
println(Serial.list());
// based on the list of serial ports printed from the
// previous command, change the 0 to your port's number:
String portnum = Serial.list()[
0];
// initialize the serial port:
myPort = new Seri