강상위

Add 01_KVP Particle & Change, Add README.md

# Particle Internet-Button Codes
- testing.html : Testing particle cloud.
- test.ino : Send particle pub => Connect to firebase functions webhook(as payload).
dependencies.InternetButton=0.1.14
\ No newline at end of file
// This #include statement was automatically added by the Particle IDE.
#include <InternetButton.h>
// // int led = D7;
// int button1 = D4;
// int button2 = D5;
// int button3 = D6;
// int button4 = D7;
// int buttonVar1;
// int buttonVar2;
// int buttonVar3;
// int buttonVar4;
InternetButton b = InternetButton();
void setup(){
// // pinMode(led, OUTPUT);
// // pinMode(button1, INPUT);
// pinMode(button2, INPUT);
// pinMode(button3, INPUT);
// // pinMode(button4, INPUT);
// // Particle.variable("buttonVar", &buttonVar, INT);
// // Particle.function("led", ledToggle);
b.begin();
}
void loop(){
// buttonVar1 = digitalRead(button1);
// buttonVar2 = digitalRead(button2);
// buttonVar3 = digitalRead(button3);
// buttonVar4 = digitalRead(button4);
if(b.buttonOn(1)){
Particle.publish("ButtonStatus","button1 pushed",PRIVATE);
delay(500);
Particle.publish("sbmtest","/phonecall.html",PRIVATE);
}
else if(b.buttonOn(2)){
Particle.publish("ButtonStatus","button2 pushed",PRIVATE);
delay(500);
Particle.publish("sbmtest","/messages.html",PRIVATE);
}
else if(b.buttonOn(3)){
Particle.publish("ButtonStatus","button3 pushed",PRIVATE);
delay(500);
Particle.publish("sbmtest","manner",PRIVATE);
}
else if(b.buttonOn(4)){
Particle.publish("ButtonStatus","button4 pushed",PRIVATE);
delay(500);
Particle.publish("sbmtest","/",PRIVATE);
}
}
// int ledToggle(String command) {
// if (command=="on") {
// digitalWrite(led,HIGH);
// return 1;
// }
// else if (command=="off") {
// digitalWrite(led,LOW);
// return 0;
// }
// else {
// return -1;
// }
// }
\ No newline at end of file
<!DOCTYPE>
<html>
<body>
<center>
<br>
<br>
<br>
<form action="https://api.particle.io/v1/devices/2d001d001447363333343437/led?access_token=d93f8e2b994532d0dd95c69db5eeac9237a01ded" method="POST">
Tell your device what to do!<br>
<br>
<input type="radio" name="arg" value="on">Turn the LED on.
<br>
<input type="radio" name="arg" value="off">Turn the LED off.
<br>
<br>
<input type="submit" value="Do it!">
</form>
</center>
</body>
</html>
\ No newline at end of file
# SBM(Silver Business Model) Demo Code
# SBM(Silver Business Model) Demo - Firebase Code
- This is the source code of SBM Demo for KVP.
- Based on the Firebase FriendlyChat codelab codes.
- fcm redirecting curl.txt : crul request for fcm.
......
# SBM Demo Actual Code
- index.html, phonecall.html, messages.html
- main.js, index.js
- main.js
- index.js : Add webhook function. Connect to Particle Webhook.
- Based on firebase tutorial - Friendly Chat Web-Start codes.
......