Windows IoT 之智能门铃
关于:
我一直想要做一个东西来即时的通过手机或者邮件通知我谁在敲我的门铃,因为我经常会因为各种各样的原因而错过那些想要来我家拜访的人。
使用这个智能门铃,你将永远都不会错过任何想要拜访你的人。
使用一个Arduino 和以太网把门铃按钮连接到互联网,然后系统通过APP连接到云端,APP有IOS 和安卓端。所以当门铃按钮被按下的时候,系统就会发送一个email或者给手机发送一个推送。
APP的名字叫Blynk,下面是APP的地址:
***链接停止解析***
***附件停止解析***
***附件停止解析***
***附件停止解析***
***附件停止解析***
Arduino代码如下:
[mw_shl_code=cpp,true]#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
SimpleTimer timer;
WidgetLCD lcd(V1);
void setup()
{
Serial.begin(9600);
Blynk.begin(auth);
while (Blynk.connect() == false) {
// Wait until connected
}
}
void notifyOnButtonPress()
{
// Invert state, since button is "Active LOW"
int isButtonPressed = !digitalRead(2);
if (isButtonPressed) {
BLYNK_LOG("Button is pressed.");
Blynk.notify("Please open up! Somebody is on the door!");
lcd.clear(); //Use it to clear the LCD Widget
lcd.print(4, 0, "Open"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
lcd.print(4, 1, "The Door!");
}
}
void emailOnButtonPress()
{
int isButtonPressed = !digitalRead(2); // Invert state, since button is "Active LOW"
if (isButtonPressed) // You can write any condition to trigger e-mail sending
{
BLYNK_LOG("Button is pressed."); // This can be seen in the Serial Monitor
Blynk.email("kaustubhagarwal18@gmail.com", "Subject: Doorbell", "Please open up! Somebody is on the door!");
lcd.clear(); //Use it to clear the LCD Widget
lcd.print(4, 0, "Open"); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
lcd.print(4, 1, "The Door!");
}
}
void loop() {
// put your main code here, to run repeatedly:
Blynk.run();
timer.run();
}[/mw_shl_code]
为防止不可控的内容风险,本站已关闭新用户注册,新贴的发表及评论;
你现在看到的内容只是互联网用户曾经发表的言论快照,仅用于老用户留存纪念,且仅与科技行业相关,全部内容不代表本站观点及立场;
本站重新开放前已针对包括用户隐私、版权保护、信息安全、国家政策在内的各种互联网法律法规要求,执行了隐患内容的自查、屏蔽和删除;
本站目前所属个人主体,未有任何盈利安排与计划,且与原WFUN.COM所属公司不存在任何关联关系;
如果本帖内容或者相关资源侵犯到您的合法权益,或者您认为存在问题,那么请您务必点此举报或投诉!