Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Camunda IoT Demo
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jonas Blatt
Camunda IoT Demo
Commits
86bd9084
Commit
86bd9084
authored
5 years ago
by
Roman Antoschin
Browse files
Options
Downloads
Patches
Plain Diff
Replace RFID_IoT_BS_final.ino
- HTTP 400 problem fixed - Comments added - Serial output revised
parent
e07b7d19
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arduino/RFID_IoT_BS_final.ino
+7
-12
7 additions, 12 deletions
arduino/RFID_IoT_BS_final.ino
with
7 additions
and
12 deletions
arduino/RFID_IoT_BS_final.ino
+
7
−
12
View file @
86bd9084
...
...
@@ -8,7 +8,7 @@
MFRC522
mfrc522
(
SS_PIN
,
RST_PIN
);
// initiate instance of MFRC522 for MF522-AN
const
char
server
[]
=
"bs19-team34.bas.uni-koblenz.de"
;
// configure network credentials (server URL)
const
char
*
ssid
=
"
IoT
2019"
;
// configure network credentials (SSID)
const
char
*
ssid
=
"
BS
2019"
;
// configure network credentials (SSID)
const
char
*
password
=
"IoTinBS2019"
;
// configure network credentials (PW)
WiFiClient
client
;
...
...
@@ -20,14 +20,13 @@ void setup() { // initial general configuration
Serial
.
print
(
"[CONNECTING TO WiFi with Network SSID: "
);
// inform about connection try
Serial
.
print
(
ssid
);
// print configured SSID
Serial
.
print
ln
(
"]"
);
Serial
.
print
(
"]
"
);
WiFi
.
begin
(
ssid
,
password
);
// start connection process
while
(
WiFi
.
status
()
!=
WL_CONNECTED
)
{
// try and indicate connecting
delay
(
1000
);
Serial
.
print
(
"."
);
}
Serial
.
println
(
""
);
Serial
.
println
(
""
);
Serial
.
println
(
"[CONNECTION SUCCESSFUL]"
);
// inform about successful connection
Serial
.
println
(
""
);
}
...
...
@@ -47,36 +46,32 @@ void loop() { // start the continuous readiness of the system
mfrc522
.
PICC_HaltA
();
// as soon as tag information has been completely read out and tag is still within range,
// put tag to sleep and wait for transmission
Serial
.
println
(
""
);
Serial
.
println
(
"[CONNECTING TO SERVER...]"
);
// inform about connection try
Serial
.
println
(
""
);
if
(
client
.
connect
(
server
,
80
))
{
// connect to configured server and execute code if successful
delay
(
1000
);
Serial
.
println
(
"[CONNECTION SUCCESSFUL]"
);
// inform about successful connection
Serial
.
println
(
""
);
Serial
.
println
(
"[TRANSMITTING RFID DATA...]"
);
// inform about transmission try
Serial
.
println
(
""
);
String
data
=
"action=append&tagId="
+
tagID
;
// prepare RFID tag data to be transmitted
client
.
println
(
"POST /api/rfid.php HTTP/1.1"
);
// transfer html content
client
.
print
(
"Host: bs19-team34.bas.uni-koblenz.de
\n
"
);
client
.
print
(
"Host: bs19-team34.bas.uni-koblenz.de
\
r\
n
"
);
client
.
println
(
"User-Agent: ESP8266/1.0"
);
client
.
println
(
"Connection: close"
);
client
.
println
(
"Content-Type: application/x-www-form-urlencoded"
);
client
.
print
(
"Content-Length: "
);
client
.
print
(
data
.
length
());
client
.
print
(
"
\n\n
"
);
client
.
println
();
client
.
println
();
client
.
print
(
data
);
// tranfser prepared RFID tag data
delay
(
500
);
Serial
.
println
(
"[TRANSMISSION SUCCESSFUL]"
);
// inform about successful transmission
Serial
.
println
(
""
);
client
.
stop
();
// close connection to server
// delay(500);
Serial
.
println
(
"[CONNECTION TO SERVER CLOSED]"
);
// inform about successful connection closure
Serial
.
println
(
""
);
}
else
{
}
else
{
Serial
.
println
(
"[ERROR: CONNECTION NOT SUCCESSFUL ! ! !]"
);
// inform about connection problem
}
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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