Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Iot Hackathon WS2020
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Sabine Dietrich
Iot Hackathon WS2020
Commits
959e46f2
Commit
959e46f2
authored
4 years ago
by
Tobias Rico Meinhardt
Browse files
Options
Downloads
Patches
Plain Diff
added survey functionality
parent
a6b7d696
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
EmulatedFidgetCube/EmulatedFidgetCube.ino
+31
-9
31 additions, 9 deletions
EmulatedFidgetCube/EmulatedFidgetCube.ino
with
31 additions
and
9 deletions
EmulatedFidgetCube/EmulatedFidgetCube.ino
+
31
−
9
View file @
959e46f2
...
...
@@ -6,19 +6,23 @@
#define IFTTT_API_KEY "jF1DREiJnO7lXPWoqcyIGb6OpMe8ANPsXBrGeJ6L41B"
#define IFTTT_EVENT_NAME "button_pressed"
#define USERNAME "Tobi"
#define IFTTT_EVENT2_NAME "button_pressed_survey"
#define USERNAME "Tobias Meinhardt"
HTTPClient
http
;
//Declare an object of class HTTPClient
// Buttons on D3 & D4
// Buttons on D3 & D4
& D5
const
int
button1
=
0
;
const
int
button2
=
2
;
const
int
mode_button
=
14
;
boolean
survey
=
false
;
void
setup
()
{
Serial
.
begin
(
115200
);
pinMode
(
button1
,
INPUT
);
pinMode
(
button2
,
INPUT
);
pinMode
(
mode_button
,
INPUT
);
WiFi
.
begin
(
ssid
,
password
);
while
(
WiFi
.
status
()
!=
WL_CONNECTED
)
{
...
...
@@ -33,16 +37,34 @@ void loop() {
if
(
WiFi
.
status
()
==
WL_CONNECTED
)
{
//Check WiFi connection status
int
button1Val
=
digitalRead
(
button1
);
int
button2Val
=
digitalRead
(
button2
);
if
(
button1Val
==
LOW
)
{
// Send POST Request to Webook from IFTTT
// (EVENT, KEY, Value1, Value2, Value3)
int
mode_buttonVal
=
digitalRead
(
mode_button
);
// Send POST Request to Webook from IFTTT
// (EVENT, KEY, Value1, Value2, Value3)
if
(
button1Val
==
LOW
&&
!
survey
)
{
send_webhook
(
IFTTT_EVENT_NAME
,
IFTTT_API_KEY
,
"Ich bin anwesend"
,
USERNAME
,
""
);
Serial
.
println
(
"Sende ich bin anwesend"
);
}
if
(
button2Val
==
LOW
)
{
if
(
button2Val
==
LOW
&&
!
survey
)
{
send_webhook
(
IFTTT_EVENT_NAME
,
IFTTT_API_KEY
,
"Ich muss die Vorlesung verlassen"
,
USERNAME
,
""
);
Serial
.
println
(
"Sende ich muss gehen"
);
}
if
(
button1Val
==
LOW
&&
survey
)
{
send_webhook
(
IFTTT_EVENT2_NAME
,
IFTTT_API_KEY
,
"JA"
,
USERNAME
,
""
);
Serial
.
println
(
"Sende JA"
);
}
if
(
button2Val
==
LOW
&&
survey
)
{
send_webhook
(
IFTTT_EVENT2_NAME
,
IFTTT_API_KEY
,
"NEIN"
,
USERNAME
,
""
);
Serial
.
println
(
"Sende NEIN"
);
}
if
(
mode_buttonVal
==
LOW
)
{
survey
=
!
survey
;
Serial
.
println
(
"Modus geändert"
);
}
}
delay
(
100
);
}
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