Go Down

Topic: Parallax RFID Scanner (Read 204 times) previous topic - next topic

Trickyrick

Having trouble getting my scanner running.  I have searched this form and found this code but it will not compile
The error is
NewSoftSerial does not name a type                 (not sure what this means)

Code: [Select]
#include "NewSoftSerial.h"
#define txPin 6
#define rxPin 8

//Reader/Writer Commands
#define RFID_READ 0x01
//#define RFID_WRITE 0x02
//#define RFID_LEGACY 0x0F

NewSoftSerial mySerial(rxPin, txPin);
int  val = 0;
//char code[6];     //Note this is 11 for the extra null char?
//int bytesread = 0;
//int flag = 0;

//Tags
//char TAG1[11] = "0800E28C60";
//char TAG2[11] = "0800D9E43E";

void setup()
{
  Serial.begin(9600);
  mySerial.begin(9600);

  //  pinMode(2, OUTPUT);
  //  pinMode(4, OUTPUT);
  pinMode(txPin, OUTPUT);     //pin 6
  pinMode(rxPin, INPUT);      //pin 8

  Serial.println("RFID Read/Write Test");
}

void loop()
{
  mySerial.print("!RW");
  mySerial.print(RFID_READ, BYTE);
  mySerial.print(3, BYTE);

  //0th read
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("Error Code:");
      Serial.println(val, HEX);
    }
  }

  //1st byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("1st:");
      Serial.println(val, HEX);
    }
  }

  //2nd byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("2nd:");
      Serial.println(val, HEX);
    }
  }

  //3rd byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("3rd:");
      Serial.println(val, HEX);
    }
  }

  //4th byte
  if(mySerial.available() > 0) {          // if data available from reader
    val = mySerial.read();
    if(val != 255){
      Serial.print("4th:");
      Serial.println(val, HEX);
    }
  }

  delay(500);                       // wait for a 1/2 second

johnwasser

It means you don't have the NewSoftSerial library installed.  You should change NewSoftSerial to SoftwareSerial which comes with Arduino 1.0.x.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy