我想将我从 arduino 中的 gsm 板上收到的文本与 Misure 和 Reset 一词进行比较,并根据请求在不同的情况下回复,但 arduino 跳转到 ams.flush() 时没有回复。请帮帮我谢谢
//Message REceiving
void receivemsg(float temperature){
char c;
char d[200];
int i;
{
Serial.println("Message received from:");
// Get remote number
sms.remoteNumber(senderNumber, 20);
Serial.println(senderNumber);
// An example of message disposal
// Any messages starting with # should be discarded
if(sms.peek()=='#')
{
Serial.println("Discarded SMS");
sms.flush();
}
// Read message bytes and print them
while(c=sms.read()){
d[i]=c;
Serial.print(c);
// for (i=0;i<200;i++){
// d[i]=c;}
}
Serial.println("\nEND OF MESSAGE");
// interpreter of the message
for (i=0;i<200;i++){
if (d[i]=='Misure')
// part of reply message
{
String t="Hello i'm Arduino: Umidità del terreno attuale (0-50): "+ String(sensorValue);
String f= " Temeratura attuale: ";
String d= ftoa(temperature,2,6);
String txt=t+f+d;
char txtMsg[200];
txt.toCharArray(txtMsg,140);
sms.beginSMS(senderNumber);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");}}
for (i=0;i<200;i++){
if (d[i]=='Reset'){
char txtMsg[200]={"Reset Received... i'm resetting now please be patient thanks"};
sms.beginSMS(senderNumber);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
//calling watchdog
Reset_AVR();}}
// Delete message from modem memory to prevent full memory space error
sms.flush();
Serial.println("MESSAGE DELETED");
delay(1000);
return;
}}