NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io


#include <Arduino.h>
#include <ArduinoJson.h>
#include <ESP8266WiFi.h>
#include <Firebase_ESP_Client.h>

#include "addons/TokenHelper.h"
#include "addons/RTDBHelper.h"

// Ağ bilgilerinizi girin
#define WIFI_SSID "Mi 9T Pro"
#define WIFI_PASSWORD "Asdfghjk12"

// Firebase proje API Key'i girin
#define API_KEY ""

// Veritabanı URL'sini girin */
#define DATABASE_URL ""

FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;

unsigned long calismaSuresi = 0;
bool signupOK = false;



void setup() {
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Ağa bağlanıyor");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Bağlandı. IP Adresi: ");
Serial.println(WiFi.localIP());
Serial.println();


config.api_key = API_KEY;

config.database_url = DATABASE_URL;

config.token_status_callback = tokenStatusCallback;


if (Firebase.signUp(&config, &auth, "", "")) {
Serial.println("Firebase bağlandı.");
signupOK = true;
} else {
Serial.printf("%sn", config.signer.signupError.message.c_str());
}

Firebase.begin(&config, &auth);
Firebase.reconnectWiFi(true);

}

void loop() {

if (Firebase.ready() && signupOK && (millis() - calismaSuresi > 5000 || calismaSuresi == 0)) {

if (!rfid.PICC_IsNewCardPresent()) //Yeni kartın okunmasını bekliyoruz.
return;

if (!rfid.PICC_ReadCardSerial()) //Kart okunmadığı zaman bekliyoruz.
return;

if (Firebase.RTDB.getString(&fbdo, "/kartlar/" + Id)) {
if (fbdo.dataType() == "json") { //gelen tipini kontrol ediliyor.

StaticJsonDocument<256> doc;
DeserializationError error = deserializeJson(doc, fbdo.stringData());

if (error) {
Serial.print(F("deserializeJson() failed: "));
Serial.println(error.f_str());
return;
}

const char* id = doc["kartId"]; // "100 300 20 30"
const char* sonHareket = doc["sonHareketTarihi"]; // "14.15.2022 15:15:50"
const char* cihaz = doc["cihaz"]; // "x-ray"
const char* sonKonum = doc["sonKonum"]; // "Yoğun Bakım"
const char* oda = doc["oda"]; // "Acil Servis"


String tarih = tarihGetir();
FirebaseJson json;
json.add("kartId", id);
json.add("tarih", tarih);

if (Firebase.RTDB.pushJSON(&fbdo, "/kayitlar/" + yeniOda, &json)) {

FirebaseJson jsonUpdate;
jsonUpdate.add("sonKonum", yeniOda);
jsonUpdate.add("sonHareketTarihi", tarih);
Firebase.RTDB.updateNode(&fbdo, "kartlar/" + Id, &jsonUpdate);
Serial.println("Giriş yapıldı. Oda: " + yeniOda);
} else {
Serial.println("HATA");
Serial.println("HATA SEBEBİ: " + fbdo.errorReason());
}
}

} else {

if (fbdo.errorReason() == "path not exist") {
Serial.println("Geçersiz kart.");
} else {
Serial.print("Beklenmeyen hata. Hata:");
Serial.println(fbdo.errorReason());
}
}
}
}

     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.