{"id":10872,"date":"2023-08-13T15:30:23","date_gmt":"2023-08-13T07:30:23","guid":{"rendered":"https:\/\/blog.iyatt.com\/?p=10872"},"modified":"2024-05-05T12:32:01","modified_gmt":"2024-05-05T04:32:01","slug":"arduino-%e4%b8%8a-sprintf-%e6%b5%ae%e7%82%b9%e6%95%b0%e8%bd%ac%e5%ad%97%e7%ac%a6%e4%b8%b2%e6%97%a0%e6%b3%95%e6%ad%a3%e5%b8%b8%e5%b7%a5%e4%bd%9c","status":"publish","type":"post","link":"https:\/\/blog.iyatt.com\/?p=10872","title":{"rendered":"Arduino \u4e0a sprintf \u6d6e\u70b9\u6570\u8f6c\u5b57\u7b26\u4e32\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c"},"content":{"rendered":"<p><img decoding=\"async\" data-src=\"https:\/\/blog.iyatt.com\/wp-content\/uploads\/2023\/08\/image-1691911016429.png\" alt=\"file\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" class=\"lazyload\" style=\"--smush-placeholder-width: 331px; --smush-placeholder-aspect-ratio: 331\/333;\" \/><\/p>\n<p>\u6bd4\u5982\u6211\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u51c6\u5907\u505a\u4e2a\u7b80\u6613\u7684\u6e29\u6e7f\u5ea6\u8ba1\uff0c\u6700\u5f00\u59cb\u76f4\u63a5\u7528\u7684 sprintf \u62fc\u63a5\u6e29\u5ea6\u548c\u6e7f\u5ea6\u7684\u5b57\u7b26\u4e32\u5230 LCD1602 \u5c4f\u5e55\u663e\u793a\uff0c\u4f46\u662f\u53d1\u73b0\u663e\u793a\u51fa\u6765\u4e0d\u662f\u672a\u77e5\u7684\u6574\u6570\u5c31\u662f\u663e\u793a\u95ee\u53f7\uff0c\u67e5\u4e86\u4e00\u4e0b\u624d\u77e5\u9053\u786e\u5b9e\u662f\u6ca1\u6cd5\u7528\u3002<br \/>\n\u8fd9\u4e2a\u53ef\u4ee5\u7528 dtostrf \u4ee3\u66ff\u5b9e\u73b0\uff1a<\/p>\n<pre><code class=\"language-cpp\">char* dtostrf(double val, signed char width, unsigned char prec, char *s)\n<\/code><\/pre>\n<p><code>val<\/code>\u4e3a\u8981\u8f6c\u6362\u7684\u6d6e\u70b9\u6570\uff1b<br \/>\n<code>width<\/code>\u53ef\u4ee5\u4e3a\u6b63\u6570\u6216\u8d1f\u6570\uff0c\u6b63\u6570\u8868\u793a\u4ece\u53f3\u7aef\u5f00\u59cb\u8ba1\u7b97\u957f\u5ea6\uff0c\u8d1f\u6570\u8868\u793a\u4ece\u5de6\u7aef\u5f00\u59cb\u8ba1\u7b97\u957f\u5ea6\u3002\u5982\u679c\u8f6c\u6362\u540e\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u8d85\u8fc7width\u6307\u5b9a\u7684\u957f\u5ea6\uff0c\u90a3\u4e48width\u53c2\u6570\u4f1a\u88ab\u5ffd\u7565\u3002\u5982\u679c\u8f6c\u6362\u540e\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u5c0f\u4e8ewidth\u6307\u5b9a\u7684\u957f\u5ea6\uff0c\u90a3\u4e48\u7a7a\u4f59\u7684\u4f4d\u7f6e\u4f1a\u7528\u7a7a\u683c\u586b\u5145;<br \/>\n<code>prec<\/code>\u4e3a\u4fdd\u7559\u7684\u5c0f\u6570\u4f4d\u6570<br \/>\n<code>s<\/code>\u5c31\u662f\u8f6c\u6362\u7ed3\u679c\u7684\u5b57\u7b26\u4e32<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6bd4\u5982\u6211\u8fd9\u4e2a\u4f8b\u5b50\uff0c\u51c6\u5907\u505a\u4e2a\u7b80\u6613\u7684\u6e29\u6e7f\u5ea6\u8ba1\uff0c\u6700\u5f00\u59cb\u76f4\u63a5\u7528\u7684 sprintf \u62fc\u63a5\u6e29\u5ea6\u548c\u6e7f\u5ea6\u7684\u5b57\u7b26\u4e32\u5230 LCD160 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"zakra_page_container_layout":"customizer","zakra_page_sidebar_layout":"customizer","zakra_remove_content_margin":false,"zakra_sidebar":"customizer","zakra_transparent_header":"customizer","zakra_logo":0,"zakra_main_header_style":"default","zakra_menu_item_color":"","zakra_menu_item_hover_color":"","zakra_menu_item_active_color":"","zakra_menu_active_style":"","zakra_page_header":true,"_lmt_disableupdate":"no","_lmt_disable":"no","footnotes":""},"categories":[1,603],"tags":[],"class_list":["post-10872","post","type-post","status-publish","format-standard","hentry","category-all","category-arduino"],"modified_by":"IYATT-yx","_links":{"self":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/10872","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10872"}],"version-history":[{"count":0,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=\/wp\/v2\/posts\/10872\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10872"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10872"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.iyatt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10872"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}