<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[serial monitor compared to M5.Lcd.print]]></title><description><![CDATA[<p dir="auto">I have been struggling a little trying to get the lcd to print in similar ways to a Serial.print. For example, I was trying to simply show a 1 or 0 based on wasPressed()<br />
[CODE]<br />
#include &lt;M5Stack.h&gt;<br />
// the setup routine runs once when M5Stack starts up<br />
void setup() {<br />
Serial.begin(115200);<br />
// initialize the M5Stack object<br />
M5.begin();<br />
M5.Lcd.drawBitmap(0, 0, 320, 240, (uint16_t *)gImage_logoM5);<br />
delay(500);<br />
M5.Lcd.fillScreen(BLACK);<br />
delay(500);<br />
delay(1000);<br />
}<br />
void loop(){</p>
<p dir="auto">bool ButtonState = (M5.BtnC.isPressed());<br />
M5.Lcd.setCursor(20, 20);<br />
M5.Lcd.print(ButtonState);//why does it only show first value and never updates<br />
Serial.print(ButtonState);<br />
M5.update();<br />
}<br />
[/CODE]<br />
In the serial monitor it updates as expected but on the M5 it only ever shows a 0. Why is that? I've seen in other examples there is a fillRect() function as shown below<br />
[CODE]<br />
#include &lt;M5Stack.h&gt;</p>
<p dir="auto">int T = 0;</p>
<p dir="auto">void setup() {<br />
m5.begin();<br />
// pinMode(servoPin, OUTPUT);<br />
M5.Lcd.setBrightness(200);<br />
M5.Lcd.setCursor(250, 215);<br />
M5.Lcd.printf("T");<br />
}</p>
<p dir="auto">void loop() {<br />
if (M5.BtnC.wasPressed())<br />
{<br />
T++;<br />
M5.Lcd.fillRect(180, 50, 70, 42, 0x00);<br />
M5.Lcd.setTextColor(0xfbe4);<br />
M5.Lcd.setTextSize(6);<br />
M5.Lcd.setCursor(180, 50);<br />
M5.Lcd.print(T);<br />
}<br />
m5.update();<br />
}<br />
[/CODE]<br />
Is M5.Lcd.fillRect() what enanbles the Lcd.print() to update. Is there a basic tutorial on using buttons to change Lcd.print() values.<br />
By the way the M5 is really a great device.</p>
]]></description><link>https://community.m5stack.com/topic/99/serial-monitor-compared-to-m5-lcd-print</link><generator>RSS for Node</generator><lastBuildDate>Sun, 08 Mar 2026 01:00:26 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/99.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Feb 2018 09:01:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to serial monitor compared to M5.Lcd.print on Sun, 18 Feb 2018 03:34:29 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/180">@jpilarski</a> Hi, i agree the M5Stack is indeed a really great device !</p>
<p dir="auto">Regarding your query, you can review a list of command functions here:   <a href="https://github.com/Kongduino/M5CheatSheet" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/Kongduino/M5CheatSheet</a></p>
<p dir="auto">Also you can review the code from this excellent working menu system by Tom Such that uses the buttons for selection:  <a href="https://github.com/tomsuch/M5Stack-SAM" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/tomsuch/M5Stack-SAM</a></p>
<p dir="auto">He also created a template program for making your own menu:<br />
<a href="https://github.com/tomsuch/M5StackSAM" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/tomsuch/M5StackSAM</a></p>
]]></description><link>https://community.m5stack.com/post/397</link><guid isPermaLink="true">https://community.m5stack.com/post/397</guid><dc:creator><![CDATA[JJ]]></dc:creator><pubDate>Sun, 18 Feb 2018 03:34:29 GMT</pubDate></item></channel></rss>