Go Down

Topic: verification problem (Read 5588 times) previous topic - next topic

L0kyy

Hi guys ,

Who can resolve my problem ?  :/



C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino: In function 'void setup()':

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:35:33: warning: invalid conversion from 'char*' to 'int' [-fpermissive]

      myTags[tagsCount] = strdup(tagID.c_str()); // Sets the master tag into position 0 in the array

                                ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino: In function 'void loop()':

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:65:26: warning: invalid conversion from 'int' to 'const char*' [-fpermissive]

    if (tagID == myTags[0]) {

                         ^

In file included from C:\Users\lokyw\OneDrive\Desktop\Programmation\Installation\arduino-nightly\hardware\arduino\avr\cores\arduino/Arduino.h:231:0,

                from sketch\sketch_jan05a.ino.cpp:1:

C:\Users\lokyw\OneDrive\Desktop\Programmation\Installation\arduino-nightly\hardware\arduino\avr\cores\arduino/WString.h:143:16: note:   initializing argument 1 of 'unsigned char String::operator==(const char*) const'

 unsigned char operator == (const char *cstr) const {return equals(cstr);}

               ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:74:34: warning: invalid conversion from 'int' to 'const char*' [-fpermissive]

            if (tagID == myTags) {

                                 ^

In file included from C:\Users\lokyw\OneDrive\Desktop\Programmation\Installation\arduino-nightly\hardware\arduino\avr\cores\arduino/Arduino.h:231:0,

                from sketch\sketch_jan05a.ino.cpp:1:

C:\Users\lokyw\OneDrive\Desktop\Programmation\Installation\arduino-nightly\hardware\arduino\avr\cores\arduino/WString.h:143:16: note:   initializing argument 1 of 'unsigned char String::operator==(const char*) const'

 unsigned char operator == (const char *cstr) const {return equals(cstr);}

               ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:75:25: warning: invalid conversion from 'const char*' to 'int' [-fpermissive]

              myTags = "";

                        ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:83:37: warning: invalid conversion from 'char*' to 'int' [-fpermissive]

          myTags[tagsCount] = strdup(tagID.c_str());

                                    ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:96:28: warning: invalid conversion from 'int' to 'const char*' [-fpermissive]

      if (tagID == myTags) {

                           ^

In file included from C:\Users\lokyw\OneDrive\Desktop\Programmation\Installation\arduino-nightly\hardware\arduino\avr\cores\arduino/Arduino.h:231:0,

                from sketch\sketch_jan05a.ino.cpp:1:

C:\Users\lokyw\OneDrive\Desktop\Programmation\Installation\arduino-nightly\hardware\arduino\avr\cores\arduino/WString.h:143:16: note:   initializing argument 1 of 'unsigned char String::operator==(const char*) const'

 unsigned char operator == (const char *cstr) const {return equals(cstr);}

               ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:96:28: warning: iteration 1 invokes undefined behavior [-Waggressive-loop-optimizations]

      if (tagID == myTags) {

                           ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:95:23: note: containing loop

    for (int i = 0; i < 100; i++) {

                      ^

In file included from C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp:8:0:

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.h: In constructor 'MFRC522Extended::MFRC522Extended(uint8_t)':

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.h:81:44: warning: 'MFRC522::MFRC522(byte)' is deprecated: use MFRC522(byte chipSelectPin, byte resetPowerDownPin) [-Wdeprecated-declarations]

 MFRC522Extended(uint8_t rst) : MFRC522(rst) {};

                                           ^

In file included from C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.h:10:0,

                from C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522Extended.cpp:8:

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.h:337:2: note: declared here

 MFRC522(byte resetPowerDownPin);

 ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp: In member function 'bool MFRC522::MIFARE_SetUid(byte*, byte, bool)':

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1853:7: warning: 'bool MFRC522::MIFARE_OpenUidBackdoor(bool)' is deprecated: will move to extra class in next version [-Wdeprecated-declarations]

 if (!MIFARE_OpenUidBackdoor(logErrors)) {

      ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1709:6: note: declared here

bool MFRC522::MIFARE_OpenUidBackdoor(bool logErrors) {

     ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1853:39: warning: 'bool MFRC522::MIFARE_OpenUidBackdoor(bool)' is deprecated: will move to extra class in next version [-Wdeprecated-declarations]

 if (!MIFARE_OpenUidBackdoor(logErrors)) {

                                      ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1709:6: note: declared here

bool MFRC522::MIFARE_OpenUidBackdoor(bool logErrors) {

     ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp: In member function 'bool MFRC522::MIFARE_UnbrickUidSector(bool)':

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1882:2: warning: 'bool MFRC522::MIFARE_OpenUidBackdoor(bool)' is deprecated: will move to extra class in next version [-Wdeprecated-declarations]

 MIFARE_OpenUidBackdoor(logErrors);

 ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1709:6: note: declared here

bool MFRC522::MIFARE_OpenUidBackdoor(bool logErrors) {

     ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1882:34: warning: 'bool MFRC522::MIFARE_OpenUidBackdoor(bool)' is deprecated: will move to extra class in next version [-Wdeprecated-declarations]

 MIFARE_OpenUidBackdoor(logErrors);

                                 ^

C:\Users\lokyw\OneDrive\Documents\Arduino\libraries\MFRC522\src\MFRC522.cpp:1709:6: note: declared here

bool MFRC522::MIFARE_OpenUidBackdoor(bool logErrors) {

     ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Installation\arduino-nightly\hardware\arduino\avr\cores\arduino\main.cpp: In function 'main':

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:96:28: warning: iteration 1 invokes undefined behavior [-Waggressive-loop-optimizations]

      if (tagID == myTags) {

                           ^

C:\Users\lokyw\OneDrive\Desktop\Programmation\Programmes Arduino\sketch_jan05a\sketch_jan05a.ino:95:23: note: containing loop

    for (int i = 0; i < 100; i++) {

                      ^



L0kyy

Code: [Select]

#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>
#include <Servo.h>
#define RST_PIN   9
#define SS_PIN    10
byte readCard[4];
int myTags[100] = {};
int tagsCount = 0;
String tagID = "";
boolean successRead = false;
boolean correctTag = false;
int proximitySensor;
boolean doorOpened = false;
// Create instances
MFRC522 mfrc522(SS_PIN, RST_PIN);
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); //Parameters: (rs, enable, d4, d5, d6, d7)
Servo myServo; // Servo motor
void setup() {
  // Initiating
  SPI.begin();        // SPI bus
  mfrc522.PCD_Init(); //  MFRC522
  lcd.begin(16, 2);   // LCD screen
  myServo.attach(8);  // Servo motor
  myServo.write(10); // Initial lock position of the servo motor
  // Prints the initial message
  lcd.print("-Pas De Carte Principale!-");
  lcd.setCursor(0, 1);
  lcd.print("    SCANNE MAINTENANT");
  // Waits until a master card is scanned
  while (!successRead) {
    successRead = getID();
    if ( successRead == true) {
      myTags[tagsCount] = strdup(tagID.c_str()); // Sets the master tag into position 0 in the array
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("Configurer La Carte Principale!");
      tagsCount++;
    }
  }
  successRead = false;
  printNormalModeMessage();
}
void loop() {
  int proximitySensor = analogRead(A0);
  // If door is closed...
  if (proximitySensor > 200) {
    if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader continue
      return;
    }
    if ( ! mfrc522.PICC_ReadCardSerial()) {   //Since a PICC placed get Serial and continue
      return;
    }
    tagID = "";
    // The MIFARE PICCs that we use have 4 byte UID
    for ( uint8_t i = 0; i < 4; i++) {  //
      readCard[i] = mfrc522.uid.uidByte[i];
      tagID.concat(String(mfrc522.uid.uidByte[i], HEX)); // Adds the 4 bytes in a single String variable
    }
    tagID.toUpperCase();
    mfrc522.PICC_HaltA(); // Stop reading
    correctTag = false;
    // Checks whether the scanned tag is the master tag
    if (tagID == myTags[0]) {
      lcd.clear();
      lcd.print("Mode programme:");
      lcd.setCursor(0, 1);
      lcd.print("Ajouter / supprimer une Carte");
      while (!successRead) {
        successRead = getID();
        if ( successRead == true) {
          for (int i = 0; i < 100; i++) {
            if (tagID == myTags[i]) {
              myTags[i] = "";
              lcd.clear();
              lcd.setCursor(0, 0);
              lcd.print("  Carte Enlevée!");
              printNormalModeMessage();
              return;
            }
          }
          myTags[tagsCount] = strdup(tagID.c_str());
          lcd.clear();
          lcd.setCursor(0, 0);
          lcd.print("   Carte Ajoutée!");
          printNormalModeMessage();
          tagsCount++;
          return;
        }
      }
    }
    successRead = false;
    // Checks whether the scanned tag is authorized
    for (int i = 0; i < 100; i++) {
      if (tagID == myTags[i]) {
        lcd.clear();
        lcd.setCursor(0, 0);
        lcd.print(" Accès Autorisé!");
        myServo.write(170); // Unlocks the door
        printNormalModeMessage();
        correctTag = true;
      }
    }
    if (correctTag == false) {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print(" Accès Refusé!");
      printNormalModeMessage();
    }
  }
  // If door is open...
  else {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print(" Porte Ouverte!");
    while (!doorOpened) {
      proximitySensor = analogRead(A0);
      if (proximitySensor > 200) {
        doorOpened = true;
      }
    }
    doorOpened = false;
    delay(500);
    myServo.write(10); // Locks the door
    printNormalModeMessage();
  }
}
uint8_t getID() {
  // Getting ready for Reading PICCs
  if ( ! mfrc522.PICC_IsNewCardPresent()) { //If a new PICC placed to RFID reader continue
    return 0;
  }
  if ( ! mfrc522.PICC_ReadCardSerial()) {   //Since a PICC placed get Serial and continue
    return 0;
  }
  tagID = "";
  for ( uint8_t i = 0; i < 4; i++) {  // The MIFARE PICCs that we use have 4 byte UID
    readCard[i] = mfrc522.uid.uidByte[i];
    tagID.concat(String(mfrc522.uid.uidByte[i], HEX)); // Adds the 4 bytes in a single String variable
  }
  tagID.toUpperCase();
  mfrc522.PICC_HaltA(); // Stop reading
  return 1;
}
void printNormalModeMessage() {
  delay(1500);
  lcd.clear();
  lcd.print("-Contrôle D'accès-");
  lcd.setCursor(0, 1);
  lcd.print(" Scannez Votre Carte!");
}

AWOL

There's a very similar problem posted in the French section
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

ballscrewbob

Many people have had issues using ONEDRIVE.
The answer in most cases is to move the sketches location back to your main computer.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Robin2

Shouldn't this be in the Programming section ?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

ballscrewbob

50/50 at the moment R2.

If it is a one drive issue then its probably better here.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Go Up