Showing
6 changed files
with
105 additions
and
2 deletions
1 | +dependencies.InternetButton=0.1.14 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +// This #include statement was automatically added by the Particle IDE. | ||
2 | +#include <InternetButton.h> | ||
3 | + | ||
4 | +// // int led = D7; | ||
5 | +// int button1 = D4; | ||
6 | +// int button2 = D5; | ||
7 | +// int button3 = D6; | ||
8 | +// int button4 = D7; | ||
9 | +// int buttonVar1; | ||
10 | +// int buttonVar2; | ||
11 | +// int buttonVar3; | ||
12 | +// int buttonVar4; | ||
13 | +InternetButton b = InternetButton(); | ||
14 | + | ||
15 | +void setup(){ | ||
16 | + | ||
17 | + // // pinMode(led, OUTPUT); | ||
18 | + // // pinMode(button1, INPUT); | ||
19 | + // pinMode(button2, INPUT); | ||
20 | + // pinMode(button3, INPUT); | ||
21 | + // // pinMode(button4, INPUT); | ||
22 | + | ||
23 | + // // Particle.variable("buttonVar", &buttonVar, INT); | ||
24 | + // // Particle.function("led", ledToggle); | ||
25 | + | ||
26 | + b.begin(); | ||
27 | + | ||
28 | + | ||
29 | +} | ||
30 | + | ||
31 | +void loop(){ | ||
32 | + // buttonVar1 = digitalRead(button1); | ||
33 | + // buttonVar2 = digitalRead(button2); | ||
34 | + // buttonVar3 = digitalRead(button3); | ||
35 | + // buttonVar4 = digitalRead(button4); | ||
36 | + | ||
37 | + if(b.buttonOn(1)){ | ||
38 | + Particle.publish("ButtonStatus","button1 pushed",PRIVATE); | ||
39 | + delay(500); | ||
40 | + Particle.publish("sbmtest","/phonecall.html",PRIVATE); | ||
41 | + } | ||
42 | + | ||
43 | + else if(b.buttonOn(2)){ | ||
44 | + Particle.publish("ButtonStatus","button2 pushed",PRIVATE); | ||
45 | + delay(500); | ||
46 | + Particle.publish("sbmtest","/messages.html",PRIVATE); | ||
47 | + } | ||
48 | + | ||
49 | + else if(b.buttonOn(3)){ | ||
50 | + Particle.publish("ButtonStatus","button3 pushed",PRIVATE); | ||
51 | + delay(500); | ||
52 | + Particle.publish("sbmtest","manner",PRIVATE); | ||
53 | + } | ||
54 | + | ||
55 | + else if(b.buttonOn(4)){ | ||
56 | + Particle.publish("ButtonStatus","button4 pushed",PRIVATE); | ||
57 | + delay(500); | ||
58 | + Particle.publish("sbmtest","/",PRIVATE); | ||
59 | + } | ||
60 | +} | ||
61 | + | ||
62 | + | ||
63 | +// int ledToggle(String command) { | ||
64 | + | ||
65 | +// if (command=="on") { | ||
66 | +// digitalWrite(led,HIGH); | ||
67 | +// return 1; | ||
68 | +// } | ||
69 | +// else if (command=="off") { | ||
70 | +// digitalWrite(led,LOW); | ||
71 | +// return 0; | ||
72 | +// } | ||
73 | +// else { | ||
74 | +// return -1; | ||
75 | +// } | ||
76 | + | ||
77 | +// } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +<!DOCTYPE> | ||
2 | +<html> | ||
3 | + <body> | ||
4 | + <center> | ||
5 | + <br> | ||
6 | + <br> | ||
7 | + <br> | ||
8 | + <form action="https://api.particle.io/v1/devices/2d001d001447363333343437/led?access_token=d93f8e2b994532d0dd95c69db5eeac9237a01ded" method="POST"> | ||
9 | + Tell your device what to do!<br> | ||
10 | + <br> | ||
11 | + <input type="radio" name="arg" value="on">Turn the LED on. | ||
12 | + <br> | ||
13 | + <input type="radio" name="arg" value="off">Turn the LED off. | ||
14 | + <br> | ||
15 | + <br> | ||
16 | + <input type="submit" value="Do it!"> | ||
17 | + </form> | ||
18 | + </center> | ||
19 | + </body> | ||
20 | +</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -# SBM(Silver Business Model) Demo Code | 1 | +# SBM(Silver Business Model) Demo - Firebase Code |
2 | - This is the source code of SBM Demo for KVP. | 2 | - This is the source code of SBM Demo for KVP. |
3 | - Based on the Firebase FriendlyChat codelab codes. | 3 | - Based on the Firebase FriendlyChat codelab codes. |
4 | +- fcm redirecting curl.txt : crul request for fcm. | ... | ... |
1 | # SBM Demo Actual Code | 1 | # SBM Demo Actual Code |
2 | - index.html, phonecall.html, messages.html | 2 | - index.html, phonecall.html, messages.html |
3 | -- main.js, index.js | 3 | +- main.js |
4 | +- index.js : Add webhook function. Connect to Particle Webhook. | ||
4 | - Based on firebase tutorial - Friendly Chat Web-Start codes. | 5 | - Based on firebase tutorial - Friendly Chat Web-Start codes. | ... | ... |
-
Please register or login to post a comment