I'm making a simple application through processing + arduino and my parallex USB rfid reader. I basically just want an LED to light up when the correct RFID is read.
This is my processing code which transmits the RFID code through to the arduino:
import processing.serial.*;
Serial rfidPort;
Serial arduinoPort;
int val;
void setup() {
println(Serial.list());
rfidPort = new Serial(this, Serial.list()[0], 2400);
rfidPort.setDTR(true);
arduinoPort = new Serial(this, Serial.list()[1], 2400);
arduinoPort.setDTR(true);
}
void draw() {
while (rfidPort.available() > 0) {
String inString = rfidPort.readString();
print(inString);
arduinoPort.write(inString);
}
}
and this is the code I have running on my arduino:
const int ledPin = 6;
int inByte;
char Str = '25005F3B1F';
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
}
void loop() {
if (Serial.available() > 0)
{
inByte = Serial.read();
if (inByte == Str) {
digitalWrite(ledPin, HIGH);
}
else {
digitalWrite(ledPin, LOW);
}
}
}
So far it seems as if I'm getting the RFID code over to the arduino fine, however I can't get the LED to light up so I must be doing something wrong.
Any suggestions?
(if it isn't already patently obvious, this is one of my first arduino experiments and my first experience in coding too)