Why does this? Idk why does this happen

All output(s):

Arduino:1.8.19 (Windows 10), Kart:"Arduino Uno"

libraries\ArduinoRTClibrary\virtuabotixRTC.cpp.o (symbol from plugin): In function `virtuabotixRTC::_DS1302_start()':

(.text+0x0): multiple definition of `rtc'

sketch\RFIDPlusRTCplusBuzzerplusKeypad.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1

Arduino Uno kartı için derleme hatası.

C:\Users\subordie\Documents\Arduino\libraries\Servo içerisinde geçersiz kütüphane bulundu: C:\Users\subordie\Documents\Arduino\libraries\Servo içinde Header dosyası (.h) bulunamadı



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

all code(s):

#include <virtuabotixRTC.h>                            //Kütüphanemizi ekliyoruz.
int CLK_PIN = SCL;                                       //6. pini clock pini olarak tanımladık
int DAT_PIN = SDA;                                       //7. pini data pini olarak tanımladık
int RST_PIN = 4;                                       //8. pini reset pini olarak tanımladık.
virtuabotixRTC myRTC(CLK_PIN, DAT_PIN, RST_PIN);
#include <Keypad.h>
#include <SPI.h>
#include <MFRC522.h>
#include <DS1302.h> 

// Keypad tanımlamaları
const byte ROWS = 4; // Satır sayısı
const byte COLS = 4; // Sütun sayısı
char keys[ROWS][COLS] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};
byte rowPins[ROWS] = {A0, A1, A2, A3}; // Satır pinleri (analog pinler)
byte colPins[COLS] = {A4, A5, 2, 3}; // Sütun pinleri (2 ve 3 dijital pinler)
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

// RFID tanımlamaları
#define SS_PIN 10
#define RST_PIN 7 // Reset pini olarak 7'yi kullanıyoruz
MFRC522 mfrc522(SS_PIN, RST_PIN);

// Buzzer ve Röle pinleri
const int buzzerPin = 6; // Buzzer pini olarak 6'yı kullanıyoruz
const int relayPin1 = 8; // Röle 1 pini
const int relayPin2 = 9; // Röle 2 pini

// DS1302 RTC modülü tanımlamaları
const int DS1302_CLK = SCL; // CLK pini (Arduino'nun SCL pini)
const int DS1302_DAT = SDA; // DAT pini (Arduino'nun SDA pini)
const int DS1302_RST = 4;   // RST pini (Dijital pin 4)
DS1302 rtc(DS1302_RST, DS1302_CLK, DS1302_DAT);


// Doğru şifre
String password = "3478";
String enteredPassword = "";

// Buzzer tonları
void playBuzzerTone(int type) {
  switch (type) {
    case 0: // Doğru şifre tonu
      tone(buzzerPin, 1000, 500);
      break;
    case 1: // Yanlış şifre tonu
      tone(buzzerPin, 200, 500);
      break;
    case 2: // RFID doğru tonu
      tone(buzzerPin, 1500, 500);
      break;
    case 3: // RFID yanlış tonu
      tone(buzzerPin, 100, 500);
      break;
    case 4: // Tuş basma sesi
      tone(buzzerPin, 500, 100);
      break;
  }
}

void setup() {
  Serial.begin(9600);
  SPI.begin();
  mfrc522.PCD_Init();

  pinMode(buzzerPin, OUTPUT);
  pinMode(relayPin1, OUTPUT);
  pinMode(relayPin2, OUTPUT);

  digitalWrite(relayPin1, LOW);
  digitalWrite(relayPin2, LOW);

  rtc.halt(false);
  rtc.writeProtect(false);
}

void loop() {
  char key = keypad.getKey();
   if (key != NO_KEY) {
    Serial.println(key);
    // Tuşa basıldığında yapılacak işlemler buraya yazılır
  }
  
  if (key) {
    playBuzzerTone(4); // Tuş basma sesi
    if (key == '#') {
      if (enteredPassword == password) {
        playBuzzerTone(0);
        openDoor();
      } else {
        playBuzzerTone(1);
      }
      enteredPassword = "";
    } else {
      enteredPassword += key;
    }
  }

  // RFID işlemleri
  if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial()) {
    String uid = "";
    for (byte i = 0; i < mfrc522.uid.size; i++) {
      uid += String(mfrc522.uid.uidByte[i], HEX);
    }
    Serial.println(uid);
    if (uid == "933A46C8" || "22EA7453") { // Doğru RFID kart UID
      playBuzzerTone(2);
      openDoor();
    } else {
      playBuzzerTone(3);
    }
    mfrc522.PICC_HaltA();
  }

  myRTC.setDS1302Time(59,15,19,4,4,07,2024);

  // RTC bilgilerini seri monitöre yazdırma
  Time t = rtc.time();
  Serial.print(t.hr);
  Serial.print(":");
  Serial.print(t.min);
  Serial.print(":");
  Serial.print(t.sec);
  Serial.print(" ");
  Serial.print(t.date);
  Serial.print("/");
  Serial.print(t.mon);
  Serial.print("/");
  Serial.print(t.yr);
  Serial.println();
  delay(1000);
}

void openDoor() {  
  digitalWrite(relayPin2, HIGH); // Röle 1'i etkinleştir (kapıyı aç)
  delay(5000); // 5 saniye boyunca kapı açık
  digitalWrite(relayPin2, LOW); // Röle 1'i devre dışı bırak (kapıyı kapat)
  digitalWrite(relayPin1, HIGH); // Röle 1'i etkinleştir (kapıyı aç)
  delay(5000); // 5 saniye boyunca kapı açık
  digitalWrite(relayPin1, LOW); // Röle 1'i devre dışı bırak (kapıyı kapat)
}

using windows 11 btw

btw i try set time, but it doesnt do it. How do i fix it (by the way, myRTC and virtuibotix rtc is by me, the rest of code is GENEREATED BY ai cuz i dont have some skills and modified by ME

they are conflicting

oh. thx

ERR 2: rtc.setDS1302Time(59,15,19,4,4,07,2024); That does not have name.











C:\Users\subordie\Documents\Arduino\Mixups!\RFIDPlusRTCplusBuzzerplusKeypad\RFIDPlusRTCplusBuzzerplusKeypad.ino: In function 'void loop()':
RFIDPlusRTCplusBuzzerplusKeypad:116:7: error: 'class DS1302' has no member named 'setDS1302Time'
   rtc.setDS1302Time(59,15,19,4,4,07,2024);
       ^~~~~~~~~~~~~
exit status 1
'class DS1302' has no member named 'setDS1302Time'

ask AI which function set time in this library

Uhm. I need to use virtuaibox RTC?

i don't know what you trying do build. name of sketch contain only used module, not the purpose, and comments in sketch are not helpful for me.

Why did you use two libraries for RTС at once? How many physical modules do you have? If one, then the two libraries will interfere with each other. Choose one and work with it

i cant tho

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.