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
3516252b
Commit
3516252b
authored
4 years ago
by
Tobias Rico Meinhardt
Browse files
Options
Downloads
Patches
Plain Diff
added alexa notification mode
parent
a0646134
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
+16
-6
16 additions, 6 deletions
EmulatedFidgetCube/EmulatedFidgetCube.ino
with
16 additions
and
6 deletions
EmulatedFidgetCube/EmulatedFidgetCube.ino
+
16
−
6
View file @
3516252b
#include
<ArduinoJson.h>
#include
<ESP8266WiFi.h>
#include
<ESP8266HTTPClient.h>
#include
<WiFiClient.h>
#include
"AnotherIFTTTWebhook.h"
#include
"WiFi_Credentials.h"
#define IFTTT_API_KEY "
jF1DREiJnO7lXPWoqcyIGb6OpMe8ANPsXBrGeJ6L41B
"
#define IFTTT_API_KEY "
c3o0F81wtGS2vXXPbnKM1tBTPY6q50V5oks-uWzBJa7
"
#define IFTTT_EVENT_NAME "button_pressed"
#define IFTTT_EVENT2_NAME "button_pressed_survey"
#define IFTTT_EVENT3_NAME "trigger_text_nachricht"
#define USERNAME "Tobias Meinhardt"
HTTPClient
http
;
//Declare an object of class HTTPClient
// Buttons on D3 & D4 & D5
const
int
button1
=
0
;
const
int
button2
=
2
;
const
int
mode_button
=
14
;
int
cubeMode
=
0
;
boolean
dataSent
=
false
;
void
setup
()
{
...
...
@@ -23,7 +25,6 @@ void setup () {
pinMode
(
button1
,
INPUT
);
pinMode
(
button2
,
INPUT
);
pinMode
(
mode_button
,
INPUT
);
}
...
...
@@ -40,8 +41,9 @@ void loop() {
int
mode_buttonVal
=
digitalRead
(
mode_button
);
if
(
mode_buttonVal
==
LOW
)
{
cubeMode
++
;
if
(
cubeMode
==
3
)
{
if
(
cubeMode
==
4
)
{
cubeMode
=
0
;
dataSent
=
false
;
}
Serial
.
println
(
"Modus geändert"
);
}
...
...
@@ -71,7 +73,8 @@ void loop() {
send_webhook
(
IFTTT_EVENT_NAME
,
IFTTT_API_KEY
,
"Ich muss die Vorlesung verlassen"
,
USERNAME
,
""
);
Serial
.
println
(
"Sende ich muss gehen"
);
}
//TODO generate sums for new spreadsheet
if
(
button1Val
==
LOW
&&
cubeMode
==
2
)
{
send_webhook
(
IFTTT_EVENT2_NAME
,
IFTTT_API_KEY
,
"JA"
,
USERNAME
,
""
);
Serial
.
println
(
"Sende JA"
);
...
...
@@ -81,6 +84,13 @@ void loop() {
send_webhook
(
IFTTT_EVENT2_NAME
,
IFTTT_API_KEY
,
"NEIN"
,
USERNAME
,
""
);
Serial
.
println
(
"Sende NEIN"
);
}
// Send notification to alexa over ifttt connected to skill "Text Nachricht" that survey is ready to download
if
(
cubeMode
==
3
&&
!
dataSent
)
{
dataSent
=
true
;
send_webhook
(
IFTTT_EVENT3_NAME
,
IFTTT_API_KEY
,
""
,
""
,
""
);
Serial
.
println
(
"Sende Auswertung fertig"
);
}
}
}
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