微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法为基于gsm的DTMF修复密码

如何解决无法为基于gsm的DTMF修复密码

我正在尝试使用DTMF自动化为我的GSM模块固定一个四位数的密码,当我的GSM解除呼叫时,它说“欢迎,请按一下以打开灯,按零来关闭灯”,方法是听以此音调,任何未知的呼叫者都可以在我的设备上进行访问,为了解决此问题,我需要添加一个四位数的引脚,当该引脚变为true时说“ 1234”,则只有GSM应该以语音对呼叫者做出响应。所以,我以这种方式尝试过,但是没有用。我怎样才能解决这个问题?这是我的代码

void update_led()
 {

 if(dtmf_cmd =='1'+'2'+'3'+'4')
 {
 Serial.print("your password is ok...");

 switch(dtmf_cmd){

 case '1' :

  digitalWrite(RED_LED_PIN,HIGH); //relay 1 on
  EEPROM.update(0,1);
  SIM800L.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  SIM800L.println("AT+CMGS=\"+91xxxxxxxxxx\"\r"); // Replace x with mobile number
  delay(1000);
  SIM800L.println("MOTOR IS ON");// The SMS text you want to send
  delay(100);
  SIM800L.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
  Serial.println("RELAY 1 ON");
  break;

 case '0':

  digitalWrite(RED_LED_PIN,LOW); //relay 1 on
  EEPROM.update(0,0);
  SIM800L.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(1000);  // Delay of 1000 milli seconds or 1 second
  SIM800L.println("AT+CMGS=\"+91xxxxxxxxxxx\"\r"); // Replace x with mobile number
  delay(1000);
  SIM800L.println("MOTOR IS OFF");// The SMS text you want to send
  delay(100);
  SIM800L.println((char)26);// ASCII code of CTRL+Z
  delay(1000);
  Serial.println("RELAY 1 OFF");
  break;



}else{
  Serial.print("your password is incorrect....");
}


}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。