libky upratovanie
This commit is contained in:
16
README.md
Normal file
16
README.md
Normal 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) |
|
||||||
@@ -12,4 +12,8 @@
|
|||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = esp32dev
|
board = esp32dev
|
||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_speed = 115200
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
arduino-libraries/NTPClient
|
||||||
|
miguelbalboa/MFRC522
|
||||||
15
src/main.cpp
15
src/main.cpp
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
constexpr bool DEBUG = true;
|
constexpr bool DEBUG = true;
|
||||||
|
|
||||||
|
|
||||||
// pins
|
// pins
|
||||||
constexpr int redLedPin = 2;
|
constexpr int redLedPin = 2;
|
||||||
constexpr int greenLedPin = 4;
|
constexpr int greenLedPin = 4;
|
||||||
@@ -21,6 +22,10 @@ constexpr int buzzerPin = 13;
|
|||||||
auto ssid = "ElaZereVsetko2g";
|
auto ssid = "ElaZereVsetko2g";
|
||||||
auto password = "CoJeElaToJeEla";
|
auto password = "CoJeElaToJeEla";
|
||||||
|
|
||||||
|
// API
|
||||||
|
const String apiUrl = "http://192.168.50.87:8111/api/timer/write";
|
||||||
|
const String timerId = "branka1";
|
||||||
|
|
||||||
// NTP client
|
// NTP client
|
||||||
WiFiUDP ntpUDP;
|
WiFiUDP ntpUDP;
|
||||||
// Europe/Prague timezone and update every 60 seconds
|
// Europe/Prague timezone and update every 60 seconds
|
||||||
@@ -110,8 +115,14 @@ void loop() {
|
|||||||
|
|
||||||
debugPrint("send: " + uidString);
|
debugPrint("send: " + uidString);
|
||||||
// Create the URL
|
// Create the URL
|
||||||
String url = "http://192.168.50.87:8111/api/timer/write/12345/" + uidString + "/" + String(timeWithMicroseconds) + "/";
|
char url[256]; // Make sure this is large enough for your URL
|
||||||
debugPrint("to: " + 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
|
// Send the HTTP GET request
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.begin(url);
|
http.begin(url);
|
||||||
|
|||||||
Reference in New Issue
Block a user