
下面是程序代码复制粘帖过去IDE中,编译好后下载到arduino中就好了。
#include "SIM900.h"
#include
//#include "inetGSM.h"
#include "sms.h"
//#include "call.h"
#include
#include
/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
it won't plug in directly as with the beaglebone. just connect ground, rx and tx between the pocketbeagle and the adapter (making sure to cross rx to tx).。 and the last 3 bits could be selected by setting the appropriate address at pins a0, a1 and a2 on the serial eeprom. therefore by using these 3 bits we could attach up to 8 microchip 24aa128 serial eeprom on the same i2c bus。set antenna configuration (tx_ant, rx_ant) on the device. parameters are bitmaps of allowed antennas to use for tx/rx. drivers may reject tx/rx mask combinations they cannot support by returning -einval (also see nl80211.h nl80211_attr_wiphy_antenna_tx).。
*/
TinyGPS gps;
#define ledpin 13
#define pwrkey 27
//**************************************************************************
char sms_rx[122]; //Received text SMS
byte type_sms=SMS_ALL; //Type of SMS
byte del_sms=1; //0: No deleting sms - 1: Deleting SMS
char number_incoming[20];
//**************************************************************************
SMSGSM sms;
int error;
boolean started=false;
bool newData = false;
char gps_year[8];
char gps_mon[3];
char gps_day[3];
char gps_hour[3];
char gps_min[3];
char gps_sec[3];
char gps_lon[20];
char gps_lat[20];
char gps_sms[100];
void setup()
{
//software power sim900 up
pinMode(pwrkey,OUTPUT);
digitalWrite(pwrkey,HIGH);

delay(600);
digitalWrite(pwrkey,LOW);
Serial.begin(115200);
Serial2.begin(9600);
if (gsm.begin(9600)) {
Serial.println("\nstatus=READY");
gsm.forceON(); //To ensure that SIM908 is not only in charge mode
started=true;
} else Serial.println("\nstatus=IDLE");
if(started)
{
//delete all sms message
Serial.println("Deleting SMS");
char error = DeleteAllSMS();
if (error==1)Serial.println("All SMS deleted");
else Serial.println("SMS not deleted");
}
else
{Serial.println("SIM900 NOT EXISTED"); while(1);}
delay(10000);
}
void loop()
{
if(started)
{
check_gps();
Check_SMS();
}
}
void Check_SMS() //Check if there is an sms 'type_sms'
{
char pos_sms_rx; //Received SMS position
pos_sms_rx=sms.IsSMSPresent(type_sms);
if (pos_sms_rx!=0)
{
//Read text/number/position of sms
sms.GetSMS(pos_sms_rx,number_incoming,sms_rx,120);
Serial.print("Received SMS from ");
Serial.print(number_incoming);

Serial.print("(sim position: ");
Serial.print(word(pos_sms_rx));
Serial.println(")");
Serial.println(sms_rx);
if (del_sms==1) //If 'del_sms' is 1, i delete sms
{
error=sms.DeleteSMS(pos_sms_rx);
if (error==1)Serial.println("SMS deleted");
else Serial.println("SMS not deleted");
}
if((strstr(sms_rx,"gps")!=0)&&(strlen(sms_rx)==3))
{
Serial.println("\nsending SMS");
if(newData)
{
if (sms.SendSMS(number_incoming, gps_sms))
Serial.println("\nSMS sent OK");
else
Serial.println("\nSMS sent error");
}
else
{
if (sms.SendSMS(number_incoming, "gps not ready"))
Serial.println("\nSMS sent OK");
else
Serial.println("\nSMS sent error");
}
}
Serial2.flush();
}
newData=false;
return;
}
char check_gps()
{
newData=false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values

for (unsigned long start = millis(); millis() - start < 1000;)
{
while (Serial2.available())
{
char c = Serial2.read();
// Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
int _year;
mktime(hour,minute,second,month,day,year)。filename=formpath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&rannum&"."&fileext。filename1=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&fileext。
s shortest man" record holder flat on the 13th what the chinese people in a hospital in rome, has died at the age of 21。according to ap headquarters on the 15th guinness book of world records in london, announced that "the world's shortest man" record holder flat on the 13th what the chinese people in a hospital in rome, has died at the age of 21.。flame cutting machine flame cutting torch flammability limits flange flare assembly flare boom flare drum flare pilot gas flare scrubber flare tower flat bar flat plate anode flat welding flaw flaw detectability flaw echo flexible hose flexible riser floater controlled valve floating cargo hose floating loading hose 26。
gps.crack_datetime(&_year,&_month,&_day,&_hour,&_minute,&_second,&_hundredths,&age);
flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6;
flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6;
dtostrf(flat, 11, 6, gps_lat);
dtostrf(flon, 10, 6, gps_lon);
strcpy(gps_sms,"lat:");
strcat(gps_sms,gps_lat);
strcat(gps_sms,"\n");
strcat(gps_sms,"lon:");
strcat(gps_sms,gps_lon);
strcat(gps_sms,"\n");
strcat(gps_sms,"time:");
itoa(_year,gps_year,10);
strcat(gps_sms,gps_year);
itoa(_month,gps_mon,10);
if(strlen(gps_mon)==1)
strcat(gps_sms,"0");
strcat(gps_sms,gps_mon);
itoa(_day,gps_day,10);
if(strlen(gps_day)==1)
strcat(gps_sms,"0");
strcat(gps_sms,gps_day);

itoa(_hour,gps_hour,10);
if(strlen(gps_hour)==1)
strcat(gps_sms,"0");
strcat(gps_sms,gps_hour);
itoa(_minute,gps_min,10);
if(strlen(gps_min)==1)
strcat(gps_sms,"0");
strcat(gps_sms,gps_min);
itoa(_second,gps_sec,10);
if(strlen(gps_sec)==1)
strcat(gps_sms,"0");
strcat(gps_sms,gps_sec);
Serial.println(gps_sms);
}
}
char DeleteAllSMS()
{
char ret_val = -1;
if (CLS_FREE != gsm.GetCommLineStatus()) return (ret_val);
gsm.SetCommLineStatus(CLS_ATCMD);
ret_val = 0; // still not present
gsm.SimpleWriteln(F("AT+CMGDA=\"DEL ALL\""));
switch (gsm.WaitResp(8000, 50, "OK")) {
case RX_TMOUT_ERR:
// response was not received in specific time
ret_val = -2;
break;
case RX_FINISHED_STR_RECV:
// OK was received => SMS deleted
ret_val = 1;
break;
case RX_FINISHED_STR_NOT_RECV:
// other response: e.g. ERROR => SMS was not deleted
ret_val = 0;
break;
}
gsm.SetCommLineStatus(CLS_FREE);
return (ret_val);
}
短信群发到达率就是指真实的到达数量和企业提交的手机号相除,排除一些不良短信群发公司人为“扣量”的情况,短信群发到达率受发送号码的质量(包含空号、关机号码)、发送内容、网关质量等因素的影响,这也是为什么短信群发的达到率不可能的原因。短信内容:发送您的qq号码到对应的接入号解除限制(发送短信,腾讯公司不收取任何费用,由当地运营商收取一条普通短信费用),稍后将手机关机5~10分钟就可以正常登录了。8.发送“ 学习 ”信号:用手机发送如下格式的数据到短信转发器,“ 学习 ”单片机gps模块有什么用,短信转发器收到后将会转发接收机学习信号单片机gps模块有什么用,并且其会向被捆绑的手机号发送“学习信号发送成功”的信息。
lat:23.036960
lon:114.418800
time:20170919114516
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/shumachanpin/article-116695-1.html
如果它硬要当作经济问题来研究
#杨洋2015金投赏##杨洋轻奢young#哈哈哈哈