嗨
你是想知道打印机是怎么工作的吗。
你需要告诉printf要打印什么。您需要一个带有标记的字符串,该标记告诉您将id(level).state写在哪里。
它。printf(100,20, id(font2), TextAlign::TOP_RIGHT, "%. "1 f id(水平).state);这是我在一个项目中使用它的方式。它。Printf (100, 20, id(font2), "%。1 f id(水平).state);
这应该打印出带有一个小数的值。如果你想要更多的话就把两个小数换成2,没有小数换成0。
它描述了https://esphome.io/components/display/index.html
在格式化的文本。
我想这个也能给你一些启示。
https://www.cplusplus.com/reference/cstdio/printf/
我希望它能帮助你
/这张