ardiuno+sim900a+温湿度动态短信-Arduino中文社区 - Powered by Discuz!

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 18868|回复: 11

ardiuno+sim900a+温湿度动态短信

[复制链接]
发表于 2015-9-10 11:55 | 显示全部楼层 |阅读模式
虽然用sim900a来发一条中文或者英文短信很简单,但是要用单片机采集温湿度之后将动态的数据放到短信的内容中还是要稍微动点脑筋的。AT指令要会一点。另外还要对ardiuno的代码熟练掌握。

我这里有代码,想要的找我哦。

QQ号:925749142

这里是一个 按键发送短信的小代码,给一些刚入门的新手参考
#include <Arduino.h>
#define KEY1 2
void setup()
{
pinMode(KEY1, INPUT_PULLUP);
Serial.begin(9600);
}
void loop()
{
Scan_KEY();   
}
void SendMessage()
{
Serial.print("AT+CSCS=\"GSM\"\r\n");
delay(1000);
Serial.print("AT+CMGF=1\r\n");
delay(1000);
   
Serial.print("AT+CMGS=\"18067933376\"\r\n");         AT指令 +电话号码
delay(1000);
Serial.print("Hello World!");   短信的内容
delay(1000);
Serial.write(0x1A);   
delay(1000);
}

void Scan_KEY()      
{
if( digitalRead(KEY1) == 0 )  
{
  delay(20);      
  if( digitalRead(KEY1) == 0 )
  {   
   while(digitalRead(KEY1) == 0);
   SendMessage();
  }
}
}

发表于 2015-9-19 17:40 | 显示全部楼层
不错不错,代码很给力啊
发表于 2015-10-3 16:34 | 显示全部楼层
ardiuno+sim900a+温湿度动态短信有程序吗
求前辈帮忙
发表于 2015-10-3 16:35 | 显示全部楼层
ardiuno+sim900a+温湿度动态短信有程序吗
求前辈帮忙     qq393651726
 楼主| 发表于 2015-10-7 13:12 | 显示全部楼层
恩恩,你的情况已经了解。
发表于 2015-11-9 20:29 | 显示全部楼层
楼主 代码有错误,请教
Arduino:1.6.6 (Windows 7), 开发板:"Arduino/Genuino Uno"

sim900a:19: error: stray '\346' in program

Serial.print("AT+CMGS=\"18067933376\"\r\n");         AT鎸囦护 +鐢佃瘽鍙风爜

^

sim900a:19: error: stray '\214' in program

sim900a:19: error: stray '\207' in program

sim900a:19: error: stray '\344' in program

sim900a:19: error: stray '\273' in program

sim900a:19: error: stray '\244' in program

sim900a:19: error: stray '\347' in program

sim900a:19: error: stray '\224' in program

sim900a:19: error: stray '\265' in program

sim900a:19: error: stray '\350' in program

sim900a:19: error: stray '\257' in program

sim900a:19: error: stray '\235' in program

sim900a:19: error: stray '\345' in program

sim900a:19: error: stray '\217' in program

sim900a:19: error: stray '\267' in program

sim900a:19: error: stray '\347' in program

sim900a:19: error: stray '\240' in program

sim900a:19: error: stray '\201' in program

sim900a:21: error: stray '\347' in program

Serial.print("Hello World!");   鐭俊鐨勫唴瀹?

^

sim900a:21: error: stray '\237' in program

sim900a:21: error: stray '\255' in program

sim900a:21: error: stray '\344' in program

sim900a:21: error: stray '\277' in program

sim900a:21: error: stray '\241' in program

sim900a:21: error: stray '\347' in program

sim900a:21: error: stray '\232' in program

sim900a:21: error: stray '\204' in program

sim900a:21: error: stray '\345' in program

sim900a:21: error: stray '\206' in program

sim900a:21: error: stray '\205' in program

sim900a:21: error: stray '\345' in program

sim900a:21: error: stray '\256' in program

sim900a:21: error: stray '\271' in program

C:\Users\Administrator\Documents\Arduino\mywork\sim900a\sim900a.ino: In function 'void SendMessage()':

sim900a:19: error: 'AT' was not declared in this scope

Serial.print("AT+CMGS=\"18067933376\"\r\n");         AT鎸囦护 +鐢佃瘽鍙风爜

                                                      ^

exit status 1
stray '\346' in program

  报告将会包含更多的信息
  "在编译时,输出详细信息"
  在 文件>首选项 中启用
QQ图片20151109202814.png
 楼主| 发表于 2015-12-2 16:45 | 显示全部楼层
       代码后面怎么不加           //         注释掉啊   
加了注释就没事了。
发表于 2016-5-18 20:59 来自手机 | 显示全部楼层
可以代码也发我一份嘛?我加你勒。。你拒绝勒
发表于 2016-7-18 14:47 | 显示全部楼层
代码很给力啊
发表于 2016-7-23 20:13 | 显示全部楼层
代码给一份!谢谢!qq:980975512
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 13:30 , Processed in 0.142452 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表