1

I have a GSM Sim900 connected to an Arduino Uno. I'm successfully able to use HTTP READ commands to show data from the web on the Arduino's serial monitor. It is showing complete HTML from that URL on the serial monitor.

Now, how should I filter data from the web? I mean I just want to display selected numbers in the serial monitor and not the complete HTML.

And secondly, how should I store these numbers into a variable so I could use them as input data for Arduino?

Thank you.

1
  • You need to learn how to parse strings with the C string library, specifically strstr(), strtok() and strchr(), as well as how to manipulate strings with pointer arithmetic. May 9, 2016 at 1:36

2 Answers 2

1

You should read the manual. More specifically the "Sim900 AT reference". I've found it on a russian server (https://www.google.nl/url?sa=t&source=web&rct=j&url=http://wiki.amperka.ru/_media/%25D0%25BF%25D1%2580%25D0%25BE%25D0%25B4%25D1%2583%25D0%25BA%25D1%2582%25D1%258B:gprs_shield:gprs-shield_sim900_at_commands.pdf&ved=0ahUKEwinze2Tp7fQAhWBMSYKHQFkBh0QFghEMA0&usg=AFQjCNGKd5Uohe7CmcJcIc1Am-SKdRsWXg&sig2=XIsvvkLWHs60sTo7FZ7tWw) but you may want to try and get it directly from the manufacturer.

In the datasheet, it will explained what values are allowed with the "at+httpread" command. You can actually specify which part you want to read. This is usefull when your Arduino can't parse the complete page.

If you have control over the page, you may also generate a device-friendly page consisting of key-value pairs, instead of it being a whole HTML page.

enter image description here

1
  • Mind that my answer only applies when the page is too big to put in a buffer at once.
    – aaa
    Nov 20, 2016 at 12:20
0

What about RapidXml? RapidXML is a very fast and small XML DOM parser written in C++. It is aimed primarily at embedded environments so might work here. Boost software license means source is freely available. http://rapidxml.sourceforge.net.

The other way to go is just parsing out the numbers with string manipulation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.