<?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[M5Paper, using canvas in procedure]]></title><description><![CDATA[<p dir="auto">Have wrote a simple program, with a procedure that use canvas.<br />
When compile the program get error message<br />
"canvas1' was not declared in this scope" .</p>
<p dir="auto">This is my program:</p>
<p dir="auto">#include &lt;M5EPD.h&gt;</p>
<p dir="auto">void setup() {<br />
M5.begin();<br />
M5.TP.SetRotation(180);<br />
M5.EPD.SetRotation(180);<br />
M5.EPD.Clear(true);<br />
canvas1.createCanvas(960, 540);<br />
canvas1.loadFont("/fonts/GenSenRounded-R.ttf", SD);<br />
DisplayDisplayWindSection(480, 270, 300, 3.5, 40)<br />
canvas1.pushCanvas(0, 0, UPDATE_MODE_GL16);</p>
<p dir="auto">}</p>
<p dir="auto">void loop() {<br />
// put your main code here, to run repeatedly:</p>
<p dir="auto">}</p>
<p dir="auto">void drawWindroos()<br />
{<br />
canvas1.loadFont("/fonts/GenSenRounded-R.ttf", SD);<br />
canvas1.createRender(30);<br />
canvas1.setTextSize(30);<br />
}</p>
<p dir="auto">The error is shown in the first line of the procedure drawWindroos.<br />
How to avoid this error?</p>
<p dir="auto">Cheers,<br />
Jan</p>
]]></description><link>https://community.m5stack.com/topic/2891/m5paper-using-canvas-in-procedure</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 15:57:55 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2891.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Feb 2021 18:23:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5Paper, using canvas in procedure on Thu, 04 Feb 2021 18:40:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/1718">@powersoft</a><br />
Do you only have 1 canvas? Try <code>canvas</code> instead of <code>canvas1</code>.</p>
<p dir="auto">BTW,  you can enclose your code in three back ticks (```) to make it easier for us to read,  like this...</p>
<pre><code>this text has three back ticks before and after it
</code></pre>
]]></description><link>https://community.m5stack.com/post/12293</link><guid isPermaLink="true">https://community.m5stack.com/post/12293</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Thu, 04 Feb 2021 18:40:06 GMT</pubDate></item></channel></rss>