Bonjour,
Mon programme consiste a lire une tag RFID
Mon probleme est le suivant le Code RFID est 010CCC93B1 et je voudrais que le programme me dise quand c'est le bon code.
Puis apres le but serait de faire une action si le capteur RFID vois le bon tag


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// RFID reader for Arduino 
// Wiring version by BARRAGAN <http://people.interaction-ivrea.it/h.barragan> 
// Modified for Arduino by djmatic
 
 
int  val = 0; 
char code[10]; 
char tag[10] = {'0','1','0','C','C','C','9','3','B','1'};
String codeRfid = ("010CCC93B1");
int bytesread = 0; 
 
void setup() { 
 
Serial.begin(2400); // RFID reader SOUT pin connected to Serial RX pin at 2400bps 
pinMode(2,OUTPUT);   // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin 
digitalWrite(2, LOW);                  // Activate the RFID reader
}  
 
 
 void loop() { 
 
  if(Serial.available() > 0) {          // if data available from reader 
    if((val = Serial.read()) == 10) {   // check for header 
      bytesread = 0; 
      while(bytesread<10) {              // read 10 digit code 
        if( Serial.available() > 0) { 
          val = Serial.read(); 
          if((val == 10)||(val == 13)) { // if header or stop bytes before the 10 digit reading 
            break;                       // stop reading 
          } 
          code[bytesread] = val;         // add the digit           
          bytesread++;                   // ready to read next digit  
        } 
      } 
      if(bytesread == 10) {              // if 10 digit read is complete 
        Serial.print("TAG code is: ");   // possibly a good TAG 
        Serial.println(code);            // print the TAG code 
      } 
      bytesread = 0; 
      digitalWrite(2, HIGH);                  // deactivate the RFID reader for a moment so it will not flood
           delay(1500);                       // wait for a bit 
           digitalWrite(2, LOW);                  // Activate the RFID reader
 
     if  
        (codeRfid == "010CCC93B1") 
 
       {
          Serial.println("c'est le bon tag");
      } 
      else{ 
        Serial.println ("c'est pas le bon tag");
      }  
 
    } 
  } 
} 
 
// extra stuff
// digitalWrite(2, HIGH);             // deactivate RFID reader
Merci d'avance