Show Posts
Pages: [1]
1  Community / Exhibition / Gallery / Re: PRFID Mod Parallax RFID reader on: November 03, 2012, 03:22:14 pm
Somehow i cant get a RDM6300 connected smiley-sad
2  International / Deutsch / Re: Tür Öffner - RFID, Bluetooth und Ethernet on: November 02, 2012, 02:48:15 pm
Vielen Dank Markus.. Jetzt habe ich es raus bekommen smiley-wink

Der Code
Code:
#include <SoftwareSerial.h>

#define ADD_TAG_CODE "200537982AA"  //change this ID with your own card TAG
#define DEL_TAG_CODE "20057370C6E"

SoftwareSerial mySerial(2, 3); // RX, TX
String msg;
String ID ;  //string to store allowed cards

void setup()  
{
  Serial.begin(9600);
  Serial.println("Serial Ready");

  mySerial.begin(9600);
  Serial.println("RFID Ready");
}

char c;

void loop(){
  
  while(mySerial.available()>0){
    c=mySerial.read();
    msg += c;
    //Serial.println(msg);  //Uncomment to view your tag ID
    //Serial.println(msg.length());
  }
  msg=msg.substring(1,13);
  if(msg.indexOf(ADD_TAG_CODE)>=0) add();
  else if(msg.indexOf(DEL_TAG_CODE)>=0) del();  
  else if(msg.length()>10) verifica();
  msg="";
  
}

void add(){
  Serial.print("What TAG do you wanna grant access?: ");
  msg="";
  while(msg.length()<13){
    while(mySerial.available()>0){
      c=mySerial.read();
      msg += c;
    }
  }
  if(ID.indexOf(msg)>=0) {
    Serial.println("\nAccess already granted for this card.");
    msg="";
  }
  else{
    Serial.print("Card: ");
    Serial.println(msg);
    ID += msg;
    ID += ",";
    //Serial.print("ID: ");
    //Serial.println(ID);
    msg="";
    Serial.println("Access granted for this card.");
  }

}

void del(){
  msg="";
  Serial.print("What TAG do you wanna deny access?: ");
  while(msg.length()<13){
    while(mySerial.available()>0){
      c=mySerial.read();
      msg += c;
    }
  }
  msg=msg.substring(1,13);
  if(ID.indexOf(msg)>=0){
    Serial.println(msg);
    Serial.println("TAG found. Access for this card denied.");
    //ID.replace(card,"");
    int pos=ID.indexOf(msg);
    msg="";
    msg += ID.substring(0,pos);
    msg += ID.substring(pos+15,ID.length());
    ID="";
    ID += msg;
    //Serial.print("ID: ");
    //Serial.println(ID);
  } else Serial.println("\nTAG not found or already denied");
  msg="";
}

void verifica(){
    msg=msg.substring(1,13);
    if(ID.indexOf(msg)>=0) Serial.println("Access granted.");
    else
    Serial.println("Access denied.");
}
3  International / Deutsch / Re: Serial.read() in HEX, XOR und andere Fragen on: November 02, 2012, 09:44:52 am
Ich habe schon das ganze erneut gepackt aber die Fehler sind weiters vorhanden.

Hab inzwischen ein neues Thread aufgemacht
http://arduino.cc/forum/index.php/topic,130364.msg980634.html#msg980634
4  International / Deutsch / Tür Öffner - RFID, Bluetooth und Ethernet on: November 02, 2012, 09:40:31 am
Hallo Deutsche Gemeinde,

Bin der karabey und bastle schon seit 10 Jahren mit Elektronischen Teilen herum. Leider nur elektronische Bauteile, daher sind mir keine Programmiersprachen bekannt.

Seit einiger Zeit habe ich Arduino und habe schon einige Tutorials befolgt um es kennenzulernen. Es waren eher kleine Tutorials und nicht so großartig wie dieses hier.

Dieses Tutorial (http://www.instructables.com/id/Arduino-and-RFID-from-seeedstudio/?ALLSTEPS) mit dem ich jetzt starten möchte, macht mir einige Probleme mit der Programmierung.

Ich möchte mir ein Tür Öffner bauen der mit RFID, Bluetooth und über Ethernet (iOS, Android) öffnen kann. Angefangen habe ich mit jetzt RFID und möchte langsam aufbauen.

Irgendwie möchte es nicht funktionieren. Michael_x und pylon haben mir zwar geholfen dennoch gibt es Fehler die ich selbst nicht beheben kann.. Hoffe auf eure Hilfe.


RFID Code:
Code:
#include "NewSoftSerial.h"

#define ADD_TAG_CODE "210014DFE309"  //change this ID with your own card TAG
#define DEL_TAG_CODE "210014E2BD6A"

NewSoftSerial RFID(2, 3);
String msg;
String ID ;  //string to store allowed cards

void setup() 
{
  Serial.begin(9600);
  Serial.println("Serial Ready");

  RFID.begin(9600);
  Serial.println("RFID Ready");
}

char c;

void loop(){
 
  while(RFID.available()>0){
    c=RFID.read();
    msg += c;
    //Serial.println(msg);  //Uncomment to view your tag ID
    //Serial.println(msg.length());
  }
  msg=msg.substring(1,13);
  if(msg.indexOf(ADD_TAG_CODE)>=0) add();
  else if(msg.indexOf(DEL_TAG_CODE)>=0) del(); 
  else if(msg.length()>10) verifica();
  msg="";
 
}

void add(){
  Serial.print("What TAG do you wanna grant access?: ");
  msg="";
  while(msg.length()<13){
    while(RFID.available()>0){
      c=RFID.read();
      msg += c;
    }
  }
  if(ID.indexOf(msg)>=0) {
    Serial.println("\nAccess already granted for this card.");
    msg="";
  }
  else{
    Serial.print("Card: ");
    Serial.println(msg);
    ID += msg;
    ID += ",";
    //Serial.print("ID: ");
   // Serial.println(ID);
    msg="";
    Serial.println("Access granted for this card.");
  }

}

void del(){
  msg="";
  Serial.print("What TAG do you wanna deny access?: ");
  while(msg.length()<13){
    while(RFID.available()>0){
      c=RFID.read();
      msg += c;
    }
  }
  msg=msg.substring(1,13);
  if(ID.indexOf(msg)>=0){
    Serial.println(msg);
    Serial.println("TAG found. Access for this card denied.");
    //ID.replace(card,"");
    int pos=ID.indexOf(msg);
    msg="";
    msg += ID.substring(0,pos);
    msg += ID.substring(pos+15,ID.length());
    ID="";
    ID += msg;
    //Serial.print("ID: ");
    //Serial.println(ID);
  } else Serial.println("\nTAG not found or already denied");
  msg="";
}

void verifica(){
    msg=msg.substring(1,13);
    if(ID.indexOf(msg)>=0) Serial.println("Access granted.");
    else Serial.println("Access denied.");
}

Fehler die jetzt erhalte ist vom NewSoftSerial.h
Code:
In file included from sketch_nov02a.cpp:1:
NewSoftSerial.h:33:2: error: #error NewSoftSerial has been moved into the Arduino core as of version 1.0. Use SoftwareSerial instead.
In file included from sketch_nov02a.cpp:1:
NewSoftSerial.h:98: error: conflicting return type specified for 'virtual void NewSoftSerial::write(uint8_t)'
/Applications/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'
5  International / Deutsch / Re: Serial.read() in HEX, XOR und andere Fragen on: November 02, 2012, 08:11:43 am
Ich habe auch ein wenig Probleme mit einem Code.. Obwohl ich NewSoftSerial.h im gleichen Ordner habe wie der Code.


Der Code

Code:
#include <NewSoftSerial.h>

#define ADD_TAG_CODE "210014DFE309"  //change this ID with your own card TAG
#define DEL_TAG_CODE "210014E2BD6A"

NewSoftSerial RFID(2, 3);
String msg;
String ID ;  //string to store allowed cards

void setup() 
{
  Serial.begin(9600);
  Serial.println("Serial Ready");

  RFID.begin(9600);
  Serial.println("RFID Ready");
}

char c;

void loop(){
 
  while(RFID.available()>0){
    c=RFID.read();
    msg += c;
    //Serial.println(msg);  //Uncomment to view your tag ID
    //Serial.println(msg.length());
  }
  msg=msg.substring(1,13);
  if(msg.indexOf(ADD_TAG_CODE)>=0) add();
  else if(msg.indexOf(DEL_TAG_CODE)>=0) del(); 
  else if(msg.length()>10) verifica();
  msg="";
 
}

void add(){
  Serial.print("What TAG do you wanna grant access?: ");
  msg="";
  while(msg.length()<13){
    while(RFID.available()>0){
      c=RFID.read();
      msg += c;
    }
  }
  if(ID.indexOf(msg)>=0) {
    Serial.println("\nAccess already granted for this card.");
    msg="";
  }
  else{
    Serial.print("Card: ");
    Serial.println(msg);
    ID += msg;
    ID += ",";
    //Serial.print("ID: ");
   // Serial.println(ID);
    msg="";
    Serial.println("Access granted for this card.");
  }

}

void del(){
  msg="";
  Serial.print("What TAG do you wanna deny access?: ");
  while(msg.length()<13){
    while(RFID.available()>0){
      c=RFID.read();
      msg += c;
    }
  }
  msg=msg.substring(1,13);
  if(ID.indexOf(msg)>=0){
    Serial.println(msg);
    Serial.println("TAG found. Access for this card denied.");
    //ID.replace(card,"");
    int pos=ID.indexOf(msg);
    msg="";
    msg += ID.substring(0,pos);
    msg += ID.substring(pos+15,ID.length());
    ID="";
    ID += msg;
    //Serial.print("ID: ");
    //Serial.println(ID);
  } else Serial.println("\nTAG not found or already denied");
  msg="";
}

void verifica(){
    msg=msg.substring(1,13);
    if(ID.indexOf(msg)>=0) Serial.println("Access granted.");
    else Serial.println("Access denied.");
}


Fehler

Quote
rfid:5: error: 'NewSoftSerial' does not name a type
rfid.cpp: In function 'void setup()':
rfid:14: error: 'RFID' was not declared in this scope
rfid.cpp: In function 'void loop()':
rfid:22: error: 'RFID' was not declared in this scope
rfid.cpp: In function 'void add()':
rfid:40: error: 'RFID' was not declared in this scope
rfid.cpp: In function 'void del()':
rfid:66: error: 'RFID' was not declared in this scope

Was mach ich den falsch?


lg
karabey
Pages: [1]