arduino控制SIM900A模块

https://item.taobao.com/item.htm?spm=a1z09.2.0.0.5fc02e8dncAF2p&id=604968021102&_u=i1qf7bf5f4ec

 

 

 请注意

后面是 回车 结束

  void sendMeg()
  {
   
  Serial.println("AT");
  delay(2000);
  Serial.println("AT+CMGF=1");
  delay(2000);
  Serial.println("AT+CMGS=\"PHONENUMBER\"");//这里改成你的号码
  delay(2000);
  Serial.print("Test\r\n");//这里写内容
  delay(2000);
  Serial.write(0x1A); //原来这里我是“Serial.print(0x1A);”,一直调不出来,后来改了才成功了,那酸爽
  
 }
void setup() {
  // put your setup code here, to run once:
 
  Serial.begin(9600);
}


void loop() {
  // put your main code here, to run repeatedly:
  delay(15*1000);
  sendMeg();
}

  

猜你喜欢

转载自www.cnblogs.com/kekeoutlook/p/11879676.html