问题描述
我正在尝试使用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 (将#修改为@)