<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix"> V arduino helpech: pro formatovani
floatu dtostrf( fPI, 4, 2, szF ); <br>
</div>
<div class="moz-cite-prefix">Pokud lze snprintf, urcite pouzivat
ten.</div>
<div class="moz-cite-prefix">Nelze nekde nastavit pouziti printf s
floatem?<br>
</div>
<div class="moz-cite-prefix"><br>
</div>
<div class="moz-cite-prefix">On 10.04.2024 18:56, Martin Záruba
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:639101e9-c4fa-4797-a468-736d08f7297b@volny.cz">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<p>Pokud chci tisknout tabulku, jde blbě použít Serial.print,
protože má variabilní počet znaků podle obsahu. Zkusil jsem
proto</p>
<div style="color: #4e5b61;background-color: #ffffff;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><div><span style="color: #4e5b61;"> </span><span style="color: #434f54;">(</span><span style="color: #00979d;">uint16_t</span><span style="color: #434f54;">) napeti</span><span style="color: #4e5b61;">;</span></div><span style="color: #4e5b61;"></span><span style="color: #4e5b61;"> </span><span style="color: #d35400;">sprintf_P</span><span style="color: #434f54;">(</span><span style="color: #4e5b61;">sStringBuffer,</span></div><div> <span style="color: #d35400;">PSTR</span><span style="color: #434f54;">(</span><span style="color: #005c5f;">"Napětí%03d.%03dV, "</span><span style="color: #434f54;">)</span></div><div><div><span style="color: #4e5b61;"> napeti</span><span style="color: #4e5b61;">/</span><span style="color: #005c5f;">1000</span><span style="color: #4e5b61;">,napeti</span><span style="color: #4e5b61;">%</span><span style="color: #005c5f;">1000</span><span style="color: #434f54;">)</span><span style="color: #4e5b61;">;</span></div><span style="color: #4e5b61;"></span></div><span style="color: #4e5b61;"> </span><span style="color: #d35400;">Serial</span><span style="color: #4e5b61;">.</span><span style="color: #d35400;">print</span><span style="color: #434f54;">(</span><span style="color: #4e5b61;">sStringBuffer</span><span style="color: #434f54;">)</span><span style="color: #4e5b61;">;</span></div>
<div style="color: #4e5b61;background-color: #ffffff;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><span style="color: #4e5b61;">
</span></div>
<div style="color: #4e5b61;background-color: #ffffff;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><span style="color: #4e5b61;">Jenže float neumí a tak jak jsem to napsal to vypisuje nesmysl pro hodnotu -123, kterou chci zobrazit jako -0.125V (ztratí se -)</span></div>
<div style="color: #4e5b61;background-color: #ffffff;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><span style="color: #4e5b61;">
</span></div>
<div style="color: #4e5b61;background-color: #ffffff;font-family: Consolas, 'Courier New', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><span style="color: #4e5b61;">Jak to správně napsat?
</span><div><span style="color: #4e5b61;">
</span></div></div>
<pre class="moz-signature" cols="72">--
Martin Záruba</pre>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
HW-list mailing list - sponsored by <a class="moz-txt-link-abbreviated" href="http://www.HW.cz">www.HW.cz</a>
<a class="moz-txt-link-abbreviated" href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</a>
<a class="moz-txt-link-freetext" href="http://list.hw.cz/mailman/listinfo/hw-list">http://list.hw.cz/mailman/listinfo/hw-list</a>
</pre>
</blockquote>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
Jindroush <a class="moz-txt-link-rfc2396E" href="mailto:jindroush@seznam.cz"><jindroush@seznam.cz></a></pre>
</body>
</html>