Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
BahnProjekt V
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Helmuth Feide
BahnProjekt V
Commits
9d6061ea
Commit
9d6061ea
authored
2 years ago
by
drouver-helmuth
Browse files
Options
Downloads
Patches
Plain Diff
modified: src/main.cpp
parent
9772a89d
Branches
Branches containing commit
Tags
scanningdataV0.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main.cpp
+37
-5
37 additions, 5 deletions
src/main.cpp
with
37 additions
and
5 deletions
src/main.cpp
+
37
−
5
View file @
9d6061ea
#include
<Arduino.h>
/*
* This ESP32 code is created by esp32io.com
*
* This ESP32 code is released in the public domain
*
* For more detail (instruction and wiring diagram), visit https://esp32io.com/tutorials/esp32-rfid-nfc
*/
#include
<SPI.h>
#include
<MFRC522.h>
#define SS_PIN 5 // ESP32 pin GIOP5
#define RST_PIN 27 // ESP32 pin GIOP27
MFRC522
rfid
(
SS_PIN
,
RST_PIN
);
void
setup
()
{
Serial
.
begin
(
9600
);
Serial
.
println
(
"Ich wurde gestartet!"
);
SPI
.
begin
();
// init SPI bus
rfid
.
PCD_Init
();
// init MFRC522
Serial
.
println
(
"Tap an RFID/NFC tag on the RFID-RC522 reader"
);
}
void
loop
()
{
if
(
rfid
.
PICC_IsNewCardPresent
())
{
// new tag is available
if
(
rfid
.
PICC_ReadCardSerial
())
{
// NUID has been readed
MFRC522
::
PICC_Type
piccType
=
rfid
.
PICC_GetType
(
rfid
.
uid
.
sak
);
Serial
.
print
(
"RFID/NFC Tag Type: "
);
Serial
.
println
(
rfid
.
PICC_GetTypeName
(
piccType
));
// print UID in Serial Monitor in the hex format
Serial
.
print
(
"UID:"
);
for
(
int
i
=
0
;
i
<
rfid
.
uid
.
size
;
i
++
)
{
Serial
.
print
(
rfid
.
uid
.
uidByte
[
i
]
<
0x10
?
" 0"
:
" "
);
Serial
.
print
(
rfid
.
uid
.
uidByte
[
i
],
HEX
);
}
Serial
.
println
();
delay
(
1000
);
Serial
.
println
(
"Ich funze!"
);
}
\ No newline at end of file
rfid
.
PICC_HaltA
();
// halt PICC
rfid
.
PCD_StopCrypto1
();
// stop encryption on PCD
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment