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

荷圆叶卷 发表于 2015-9-10 11:55

ardiuno+sim900a+温湿度动态短信

虽然用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();
}
}
}

123456a 发表于 2015-9-19 17:40

不错不错,代码很给力啊

1373513133 发表于 2015-10-3 16:34

ardiuno+sim900a+温湿度动态短信有程序吗
求前辈帮忙

1373513133 发表于 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

报告将会包含更多的信息
"在编译时,输出详细信息"
在 文件>首选项 中启用

荷圆叶卷 发表于 2015-12-2 16:45

       代码后面怎么不加         //         注释掉啊   
加了注释就没事了。

sunny波板糖 发表于 2016-5-18 20:59

可以代码也发我一份嘛?我加你勒。。你拒绝勒

lwsz 发表于 2016-7-18 14:47

代码很给力啊

nnxlcy 发表于 2016-7-23 20:13

代码给一份!谢谢!qq:980975512
页: [1] 2
查看完整版本: ardiuno+sim900a+温湿度动态短信