家居安防报警器,参考程序。

火灾报警

涉及用sim800c发短信,拨打电话通知。

接线:

Sim800c 3.3V -> Arduino 3.3V
Sim800c GND -> Arduino GND
Sim800c RX -> Arduino TX
Sim800c TX -> Arduino RX
#include <SoftwareSerial.h>        // 采用软件的串口
#define Infrared 7 //启动开关 SoftwareSerial SIM800C(10, 11); // Serial RX, TX
boolean bState, bOldState;
int incomingByte = 0; // for incoming serial data
int Infrared_NUM = 0; void setup() {
// put your setup code here, to run once:
// Open serial communications and wait for port to open
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(Infrared,INPUT_PULLUP);
digitalWrite(13,LOW);
digitalWrite(12,LOW); Serial.begin(9600);
while (!Serial) { // wait for serial port to connect. Needed for native USB port only
} Serial.println("Good Morning, my old friend!"); SIM800C.begin(9600);
SIM800C.println("AT+CMGF=1"); } void loop() {
// put your main code here, to run repeatedly:
if (SIM800C.available()) {
Serial.write(SIM800C.read());
digitalWrite(13, HIGH);// 如果通信成功,则把Arduino上面的L13 LED 灯打开
}
if (Serial.available()) {
SIM800C.write(Serial.read());
// incomingByte = Serial.read();
// Serial.print("I received: ");
// Serial.println(incomingByte, DEC);
// digitalWrite(13, !digitalRead(13));
} Infrared_NUM = digitalRead(Infrared);//检测启动开关
if(Infrared_NUM == LOW){
// sendMeg();//发送短信例程代码
SIM800C.println("AT");
delay(2000);
SIM800C.println("ATD12345678900;\r");//12345678900改成你要拨打的电话号码
digitalWrite(12,HIGH);
delay(5000);
while(!digitalRead(Infrared));
digitalWrite(12,LOW);
//SIM800C.println("ATH");
delay(1000);
}
} //发送短信例程代码
void sendMeg()
{ SIM800C.println("AT");
delay(2000);
SIM800C.println("AT+CMGF=1");
delay(2000);
SIM800C.println("AT+CMGS=\"12345678900\"");//这里改成你的号码
delay(2000);
SIM800C.print("Test\r\n");//这里写内容
delay(2000);
SIM800C.write(0x1A);//发送:0x1A,即“CTRL+Z”的键值,用于告诉 SIM800C,要执行发送操作
//发送: 0x1B,即“ESC”的键值,用于告诉 SIM800C,取消本次操作,不执行发送。
}

在这里我们发送了一个AT命令,SIM800C返回一个Ok。再发送一个AT+GSV,返回:

  13:33:20.943 -> SIMCOM_Ltd

  13:33:20.943 -> SIMCOM_SIM800C

  13:33:20.979 -> Revision:1418B06SIM800C24

  通讯成功。任务初步完成。

//参考资料

//指令https://blog.csdn.net/cqdawnxsg/article/details/80680270

//https://www.cnblogs.com/xiaqiuchu/p/11568269.html

//https://www.arduino.cn/thread-6985-1-1.html

Arduino+sim800C家居安防火灾报警 拨打电话 发送短信例程程序的更多相关文章

  1. Android-读取操作系统通话记录并/拨打电话/发送短信/复制号码到拨号盘

    apps目录的contacts应用(有读取通话记录功能),是访问provider目录的provider.contacts应用(有暴露通话记录),所以要阅读Android操作系统源码-->pack ...

  2. iOS_拨打电话/发送短信

    GitHub address : https://github.com/mancongiOS/makeACallAndSendMessage.git 功能一: 拨打电话 1.可以有提示框.提示该电话号 ...

  3. android 入门 002 (拨打电话,发送短信)

    一.拨打电话 1.首先做好界面,代码如下: layout =>activity_main.xml 中 <LinearLayout xmlns:android="http://sc ...

  4. 调用 url_launcher 模块打开外部浏 览器 打开外部应用 拨打电话 发送短信

    1.Flutter url_launcher 模块    Flutter url_launcher 模块可以让我们实现打开外部浏览器.打开外部应用.发送短信.拨打电话等功能.    https://p ...

  5. IOS中调用系统拨打电话发送短信

    一.调用打电话界面 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat ...

  6. android使用Intent操作拨打号码发送短信

    Activity程序Activity.java package com.example.intentcaseproject; import android.net.Uri; import androi ...

  7. html5 安卓拨打电话 发短信

    方法一: <input name=”phone_no” format=”*m” value=”13″/> <do type=”option” label=”呼出号”> < ...

  8. zabbix实现电话、短信、邮件报警

    该报警方式提前说明:(1)该方式可以实现zabbix免费电话报警以及微信.短信.邮件报警,但有数量限制.详见如下:如数量不能满足需要以及人员需要,可以考虑购买收费版.(2)毕竟是免费版,电话通知要省着 ...

  9. ios调用本地拨打电话,发送短信

    电话.短信是手机的基础功能,iOS中提供了接口,让我们调用.这篇文章简单的介绍一下iOS的打电话.发短信在程序中怎么调用. 1.打电话   [[UIApplication sharedApplicat ...

随机推荐

  1. web项目——javax.servlet.ServletException: Circular view path [registerForm]

    报错: 控制台输出: 三月 21, 2019 10:12:32 上午 org.springframework.web.servlet.PageNotFound noHandlerFound 警告: N ...

  2. js生成一个上限跟下限的随机数

    function sj() { //x上限,y下限 var x = 2000; var y = 1800; var rand = parseInt(Math.random() * (x - y + 1 ...

  3. 同一父进程下的子进程之间的通信(pipe通信)

    首先对于fork命令  通过fork命令创建进程 父进程返回子进程id 子进程返回0 失败返回-1 对于pipe通讯机制   pipe通讯是半双工的 也就是说只能一方读一方写 题目中想要P1的输出作为 ...

  4. 破解webstorm 亲测有效

    一.首先安装好webstorm,并且配置hosts文件 二.使用以下激活码进行激活,亲测有效可以用到2099年 4RULSIH54N-eyJsaWNlbnNlSWQiOiI0UlVMU0lINTROI ...

  5. Pytorch分类和准确性评估--基于FashionMNIST数据集

    最近在学习Pytorch v1.3最新版和Tensorflow2.0. 我学习Pytorch的主要途径:莫烦Python和Pytorch 1.3官方文档 ,Pytorch v1.3跟之前的Pytorc ...

  6. jQuery——选择器效率

    N1:$('#box').find('p'):最快,直接了当的找到对应的节点jQuery对象: N2:$('p','#box'):注意不是$('p,#box')!!!,jQuery会按照从右往左的顺序 ...

  7. 数据库原理实验指导(三)使用SQL语言进行简单查询【转载csdn】

    --1.查询全体学生的学号和姓名select sno,sname from student --2.查询全体学生的详细记录select * from student --3.查询软件学院的学生姓名,年 ...

  8. Chisel3 - bind - Binding

    https://mp.weixin.qq.com/s/2318e6VJ4wFGpWwBOmTikA   Chisel数据类型(Data)与Module的绑定关系,根据Data的使用方式不同,而有多种绑 ...

  9. brpc长连接问题

    问题: 使用了brpc的长连接,但是为何耗时和短链接一样呢? brpc文档里介绍,使用http协议,则默认使用pooled,只要连接数不超过max_connection_pool_size,则都可以使 ...

  10. Java实现 蓝桥杯VIP 算法训练 连通分块(并查集)

    试题 算法训练 连通分块 资源限制 时间限制:200ms 内存限制:8.0MB 问题描述 连通分块 输入格式 输入的第一行包含两个整数n, m n代表图中的点的个数,m代表边的个数 接下来m行,每行2 ...