<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pl-pl">
<link rel="self" type="application/atom+xml" href="https://forum.atnel.pl/feed.php?f=47&amp;t=17800&amp;mode" />

<title>ATNEL tech-forum</title>
<link href="https://forum.atnel.pl/index.php" />
<updated>2017-03-05T20:43:51+01:00</updated>

<author><name><![CDATA[ATNEL tech-forum]]></name></author>
<id>https://forum.atnel.pl/feed.php?f=47&amp;t=17800&amp;mode</id>
<entry>
<author><name><![CDATA[globalinfo]]></name></author>
<updated>2017-03-05T20:43:51+01:00</updated>
<published>2017-03-05T20:43:51+01:00</published>
<id>https://forum.atnel.pl/viewtopic.php?t=17800&amp;p=184137#p184137</id>
<link href="https://forum.atnel.pl/viewtopic.php?t=17800&amp;p=184137#p184137"/>
<title type="html"><![CDATA[Wyszukiwanie zmiennych w ciągu.]]></title>

<content type="html" xml:base="https://forum.atnel.pl/viewtopic.php?t=17800&amp;p=184137#p184137"><![CDATA[
Witam,<br /><br />Próbuję wyłuskać dane przesłane ze strony WWW.<br /><br />Na razie udało mi się wydobyć wartość dla zmiennej - fan. Chciałbym jeszcze wyciągnąć dane dla pozostałych zmiennych - temp i wil. <br />Możecie mi podpowiedzieć jak to zrobić. <img src="https://forum.atnel.pl/images/smilies/icon_question.gif" alt=":?:" title="Znak zapytania" /> <br /><br />Wynik jaki mam na serial monitorze.<br /><div class="quotetitle"><b>Quote:</b></div><div class="quotecontent"><br />[HTTP] begin... <br />[HTTP] GET... <br />[HTTP] GET... code: 200 <br />16 <br />fan=wlacz&amp;temp=7&amp;wil=9 <br />A=1 <br />0 <br /><br />A=1 <br />wlacz <br />[HTTP] connection closed or file end.<br /></div><br />...<br />[syntax=csharp]void loop() {<br />// wait for WiFi connection<br />if((WiFiMulti.run() == WL_CONNECTED)) {<br />HTTPClient http;<br />USE_SERIAL.print(&quot;&#91;HTTP&#93; begin...\n&quot;);<br />// configure server and url<br />http.begin(&quot;http://.............................../wyslij2.php&quot;);<br /><br />USE_SERIAL.print(&quot;&#91;HTTP&#93; GET...\n&quot;);<br />// start connection and send HTTP header<br />int httpCode = http.GET();<br />if(httpCode &gt; 0) {<br />// HTTP header has been send and Server response header has been handled<br />USE_SERIAL.printf(&quot;&#91;HTTP&#93; GET... code: %d\n&quot;, httpCode);<br /><br />// file found at server<br />if(httpCode == HTTP_CODE_OK) {<br /><br />// get lenght of document (is -1 when Server sends no Content-Length header)<br />int len = http.getSize();<br /><br />// create buffer for read<br />uint8_t buff&#91;128&#93; = { 0 };<br /><br />// get tcp stream<br />WiFiClient * stream = http.getStreamPtr();<br /><br />// read all data from server<br />while(http.connected() &amp;&amp; (len &gt; 0 || len == -1)) {<br />// get available data size<br />size_t size = stream-&gt;available();<br /><br />if(size) {<br />// read up to 128 byte<br />int c = stream-&gt;readBytes(buff, ((size &gt; sizeof(buff)) ? sizeof(buff) : size));<br />// write it to Serial<br /><br />USE_SERIAL.write(buff, c);<br />if(len &gt; 0) {<br />len -= c;<br />}<br />}<br />calosc = &quot;&quot;;<br />for(int x = 8;x &lt; 13;x++)<br />{<br />calosc += (char)buff&#91;x&#93;;<br />}<br />if(calosc ==&quot;wylacz&quot;){ a=0;USE_SERIAL.println(&quot;A=0&quot;);}<br />if(calosc ==&quot;wlacz&quot;){ a=1;USE_SERIAL.println(&quot;A=1&quot;);}<br />delay(1);<br />}<br />USE_SERIAL.println(calosc); <br />USE_SERIAL.print(&quot;&#91;HTTP&#93; connection closed or file end.\n&quot;);<br />}<br />} else {<br />printf(&quot;&#91;HTTP&#93; GET... failed, error: %s\n&quot;, http.errorToString(httpCode).c_str());<br />}<br /><br />http.end();<br />}<br /><br />if (a==1){digitalWrite(LED, LOW);<br />}<br />delay(2000);<br />if (a==0){digitalWrite(LED, HIGH);<br />}<br />delay(7000);<br />}[/syntax]<p>Statystyki: Napisane przez <a href="https://forum.atnel.pl/memberlist.php?mode=viewprofile&amp;u=13055">globalinfo</a> — 5 mar 2017, o 20:43</p><hr />
]]></content>
</entry>
</feed>