-
-
Save neosarchizo/803a82098f3179494d23 to your computer and use it in GitHub Desktop.
[Blynk] IoT 창문 감시 1부
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
동영상에 수정하고 있던 것을 사용했기 때문에 여기 있는 것과 많이 다를거에요;;
동영상에 있는 것은 무시하시고 그냥 여기 있는 것 기준으로 봐주세요^-^;;