Store value in variable after HTTPREAD

给你一囗甜甜゛ 提交于 2019-11-26 19:13:18
Billa

First you should initialize a char array named a for storing the value and also declare a variable int flag=0;.

Then modify your toSerial() function as follows:

void toSerial() {
  while(gprsSerial.available()!=0) {
    if( gprsSerial.read() == '[' )
      flag=2;
    else if(flag == 2 && gprsSerial.read() == ':')
      while(gprsSerial.read() != '}') {
        a[i]= gprsSerial.read();
        i++;
      }
    else if(flag == 0)
      Serial.write(gprsSerial.read());
    else
      flag--;
  }
}

Start by acquiring a large A3 sheet of paper, find a red pen and write 1000 times

I will never use delay as a substitute for reading and parsing responses from a modem.

I will never use delay as a substitute for reading and parsing responses from a modem.

I will never use delay as a substitute for reading and parsing responses from a modem.

I will never use delay as a substitute for reading and parsing responses from a modem.

I will never use delay as a substitute for reading and parsing responses from a modem.

...

Then read this answer, following the instructions regarding V.250. And when you have properly digested all information from the answer (it probably takes some time to let all sink in), then follow the link to another answer in the comment below it (which contains information to capture response content).


Of course the first part was meant to be funny, but I am dead serious about the rest; you have some huge AT command knowledge "holes" you must fill. You will not be able to get any information out until you do. It should not be very difficult, but it will require some effort.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!