Can't fix error messages (newbie)

I have setup a RFID access control system but am having some troubles with the code which is at Online Notes with Privacy and Publishing because I couldn't fit it on this forum. This is the error messages I am getting:

Arduino: 1.5.5 (Mac OS X), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

ApartmentRFIDSystem.ino: In function 'void loop()':
ApartmentRFIDSystem:146: error: 'RFIDReader' was not declared in this scope
ApartmentRFIDSystem:147: error: 'Wiegand' was not declared in this scope
ApartmentRFIDSystem:147: error: expected `;' before 'RFIDReader'
ApartmentRFIDSystem.ino: In function 'void removeUserHash(String)':
ApartmentRFIDSystem:276: error: ambiguous overload for 'operator=' in 'RFIDArr[slot] = 0'
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:86: note: candidates are: String& String::operator=(const String&)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:87: note: String& String::operator=(const char*)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:88: note: String& String::operator=(const __FlashStringHelper*)
ApartmentRFIDSystem:277: error: ambiguous overload for 'operator=' in 'userArr[slot] = 0'
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:86: note: candidates are: String& String::operator=(const String&)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:87: note: String& String::operator=(const char*)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:88: note: String& String::operator=(const __FlashStringHelper*)
ApartmentRFIDSystem:291: error: ambiguous overload for 'operator=' in 'RFIDArr[probe] = 0'
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:86: note: candidates are: String& String::operator=(const String&)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:87: note: String& String::operator=(const char*)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:88: note: String& String::operator=(const __FlashStringHelper*)
ApartmentRFIDSystem:292: error: ambiguous overload for 'operator=' in 'userArr[probe] = 0'
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:86: note: candidates are: String& String::operator=(const String&)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:87: note: String& String::operator=(const char*)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:88: note: String& String::operator=(const __FlashStringHelper*)
ApartmentRFIDSystem.ino: In function 'void data0Int()':
ApartmentRFIDSystem:822: error: 'RFIDReader' was not declared in this scope
ApartmentRFIDSystem.ino: In function 'void data1Int()':
ApartmentRFIDSystem:825: error: 'RFIDReader' was not declared in this scope
ApartmentRFIDSystem.ino: In function 'String pairingMode()':
ApartmentRFIDSystem:832: error: 'RFIDReader' was not declared in this scope
ApartmentRFIDSystem:853: error: conversion from 'int' to 'String' is ambiguous
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:61: note: candidates are: String::String(const __FlashStringHelper*)
/FILES/Peterson (1.1.11 BU)/Affairs/Family/Anders/Arduino.app/Contents/Resources/Java/hardware/arduino/avr/cores/arduino/WString.h:59: note: String::String(const char*)

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

ApartmentRFIDSystem:146: error: 'RFIDReader' was not declared in this scope

Do you have the RFIDReader library installed?

Oh ya!

:smiley:

SIncerely,
Anders

anderspeterson:
Oh ya!

:smiley:

SIncerely,
Anders

Is that "Yes, I do have it installed and it still doesn't work", or "Oops, I forgot to do that and now it works, I'm such a n00b :wink: "...?

I couldn't find a specific, "RFIDReader Library"

Could you provide me with a link?

Thanks,
Anders

Ah, that took a bit of head scratching, and what I found doesn't bode well for the rest of the code.

The RFIDReader object is an instance of the Wiegand class, so I assume you have the right Wiegand library installed (I found a couple of them). However, one obvious mistake in that code:

void loop(){
  String tag = RFIDReader.getTag(); //Check if an RFID tag is available
  Wiegand RFIDReader; //Initialize RFID reader using wiegand interface

That's not going to work, now, is it...?

Is this your code, or code from someone else you are trying to get to work?

The code was sent to me by someone else, but I haven't got a reply in a long, long time, so I decided to come and ask the fellow people on the Arduino Forums.

Sincerely,
Anders

Well, you first need to fix the "you can't use an object on the line before you create that object" problem, and then you have to make sure you have the right Weigand library installed. Neither of the libraries I found have a .getTag() method, so you're on your own there I'm afraid. Did this friend of yours provide you with a Weigand library with the code...?

Sorry, I'm kind of a newbie to arduino! Do you think you could explain this better to me or fix the errors on my online notepad?

Thanks,
Anders

Please help!

Thanks,
Anders

Do you think you could explain this better to me

How much clearer do you need to have "You can't use an object (RFIDReader) before you create the object"?

Put the Arduino away for a while. Get a C programming book. Learn some programming. Then, get a C++ book. Learn some more programming. Then, get the Arduino back out. The order that the statements need to be in will be a lot clearer then.

PaulS:

Do you think you could explain this better to me

How much clearer do you need to have "You can't use an object (RFIDReader) before you create the object"?

Put the Arduino away for a while. Get a C programming book. Learn some programming. Then, get a C++ book. Learn some more programming. Then, get the Arduino back out. The order that the statements need to be in will be a lot clearer then.

What he said.

You're calling RFIDReader.getTab() the line before you create the RFIDReader object. That and I have to assume you have the right Weigand library, which I cannot tell as you haven't provided the library, and none of the libraries I have found are suitable.

PaulS:

Do you think you could explain this better to me

How much clearer do you need to have "You can't use an object (RFIDReader) before you create the object"?

Put the Arduino away for a while. Get a C programming book. Learn some programming. Then, get a C++ book. Learn some more programming. Then, get the Arduino back out. The order that the statements need to be in will be a lot clearer then.

Wow!

How is learning C (cout, printf etc) and all the routines NOT used in Arduino going to help?!

Might as well tell him to learn Java first (just because it shares similarities)

How is learning C (cout, printf etc) and all the routines NOT used in Arduino going to help?!

How many C programs have you seen that use cout? Not too many, I'm guessing.

Learning to program is not just a matter of getting the compiler to quit complaining. It is a matter of understanding what is possible, and the correct order that things need to be done in.

OP really appears to be quite clueless about programming in general. Before taking on complicated projects, doing simple(r) ones first makes more sense to me. Clearly, you see things differently.

You need to learn what #include does,

and then find the library code for the device you are using ( if such code exists )

and then put that code in the correct place in your folders/directories

and then #include the name of the library in your arduino sketch.

It's a four-step plan.