libky upratovanie

This commit is contained in:
2025-03-07 19:47:04 +01:00
parent b12dd31f8e
commit db4b933981
3 changed files with 34 additions and 3 deletions

16
README.md Normal file
View File

@@ -0,0 +1,16 @@
# kalsketimer
## tu som ukradol kod na citanie RFID kariet
[https://randomnerdtutorials.com/esp32-mfrc522-rfid-reader-arduino/](https://randomnerdtutorials.com/esp32-mfrc522-rfid-reader-arduino/)
| MFRC522 RFID Reader | ESP32 | Description |
|---------------------|-------|-------------|
| SDA | GPIO 5 | SPI signal input, I2C data line, or UART data input |
| SCK | GPIO 18 | SPI clock |
| MOSI | GPIO 23 | SPI data input |
| MISO | GPIO 19 | SPI master-in-slave-out, I2C serial clock, or UART serial output |
| IRQ | Don't connect | Interrupt pin; signals the microcontroller when an RFID tag is nearby |
| GND | GND | Ground connection |
| RST | GPIO 21 | LOW signal to put the module in power-down mode; send a HIGH signal to reset the module |
| 3.3V | 3.3V | Power supply (2.5-3.3V) |

View File

@@ -12,4 +12,8 @@
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
monitor_speed = 115200
lib_deps =
arduino-libraries/NTPClient
miguelbalboa/MFRC522

View File

@@ -11,6 +11,7 @@
constexpr bool DEBUG = true;
// pins
constexpr int redLedPin = 2;
constexpr int greenLedPin = 4;
@@ -21,6 +22,10 @@ constexpr int buzzerPin = 13;
auto ssid = "ElaZereVsetko2g";
auto password = "CoJeElaToJeEla";
// API
const String apiUrl = "http://192.168.50.87:8111/api/timer/write";
const String timerId = "branka1";
// NTP client
WiFiUDP ntpUDP;
// Europe/Prague timezone and update every 60 seconds
@@ -110,8 +115,14 @@ void loop() {
debugPrint("send: " + uidString);
// Create the URL
String url = "http://192.168.50.87:8111/api/timer/write/12345/" + uidString + "/" + String(timeWithMicroseconds) + "/";
debugPrint("to: " + url);
char url[256]; // Make sure this is large enough for your URL
snprintf(url, sizeof(url), "%s/%s/%s/%s/",
apiUrl.c_str(),
timerId.c_str(),
uidString.c_str(),
timeWithMicroseconds);
debugPrint(url);
// Send the HTTP GET request
HTTPClient http;
http.begin(url);