how to compare array of chars with arduino -
i want compare text receive gsm board in arduino word misure , reset , reply in different case depending on request arduino jump on ams.flush() without reply nothing. please me
//message receiving void receivemsg(float temperature){ char c; char d[200]; int i; { serial.println("message received from:"); // remote number sms.remotenumber(sendernumber, 20); serial.println(sendernumber); // example of message disposal // messages starting # should discarded if(sms.peek()=='#') { serial.println("discarded sms"); sms.flush(); } // read message bytes , print them while(c=sms.read()){ d[i]=c; serial.print(c); // (i=0;i<200;i++){ // d[i]=c;} } serial.println("\nend of message"); // interpreter of message (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");}} (i=0;i<200;i++){ if (d[i]=='reset'){ char txtmsg[200]={"reset received... i'm resetting please patient thanks"}; sms.beginsms(sendernumber); sms.print(txtmsg); sms.endsms(); serial.println("\ncomplete!\n"); //calling watchdog reset_avr();}} // delete message modem memory prevent full memory space error sms.flush(); serial.println("message deleted"); delay(1000); return; }}
Comments
Post a Comment