Skip to content

Instantly share code, notes, and snippets.

@neosarchizo
Last active December 15, 2015 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neosarchizo/803a82098f3179494d23 to your computer and use it in GitHub Desktop.
Save neosarchizo/803a82098f3179494d23 to your computer and use it in GitHub Desktop.
[Blynk] IoT 창문 감시 1부
#define BLYNK_PRINT Serial
#include <Bridge.h>
#include <BlynkSimpleYun.h>
#include <SimpleTimer.h>
#define REED_SWITCH 2
char auth[] = "YourAuthToken";
SimpleTimer timer;
WidgetLED led(V0);
void setup()
{
pinMode(REED_SWITCH, INPUT_PULLUP);
Serial.begin(9600);
Blynk.begin(auth);
timer.setInterval(1000L, checkSwitch);
}
void loop()
{
Blynk.run();
timer.run();
}
void checkSwitch() {
int state = digitalRead(REED_SWITCH);
if (state == LOW)
led.on();
else
led.off();
}
@neosarchizo
Copy link
Author

동영상에 수정하고 있던 것을 사용했기 때문에 여기 있는 것과 많이 다를거에요;;
동영상에 있는 것은 무시하시고 그냥 여기 있는 것 기준으로 봐주세요^-^;;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment