post - String object in arduino becomes empty -
i using arduino develop small iot project. till working fine. steps of projects are:
- create xml string sensor reading
- send xml post server.
the odd thing first 3 trials work perfectly. however, after that, string holding xml becomes empty.
below portion of code:
void loop() { while (serial3.available()>0) { char c = serial3.read(); if (gps.encode(c)){ createxml(); delay(1000); if(seconds_passed==10000 && !isxmlempty) { xml+="\n</start>"; serial.print(xml); serial.print(f("send server")); seconds_passed=0; isxmlempty=true; string temp =""; temp = "xml="+xml; char *param = new char[temp.length()+1]; temp.tochararray(param,temp.length()); serial.println(param); if(!postpage(servername,serverport,pushpage,"xml=123")) serial.print(f("fail ")); else serial.print(f("pass ")); xml=""; xml="<start>\n\t"; } } } // if(data==false){ serial.println("no data"); } }
i thing problem string object. might memory issue. idea?
Comments
Post a Comment