<?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[M5-bit (Micro-Bit)  part 2]]></title><description><![CDATA[<p dir="auto">Turn your Micro-Bit leds on/off with the M5, create your own smilies on the M5.. ect..</p>
<p dir="auto"><img src="/assets/uploads/files/1577130123044-img_20191223_203318.jpg" alt="0_1577130117472_IMG_20191223_203318.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">Here is the Micro-Bit code ;</p>
<p dir="auto"><img src="/assets/uploads/files/1577130162698-image1-resized.jpg" alt="0_1577130157915_Image1.jpg" class=" img-fluid img-markdown" /></p>
<p dir="auto">And te M5Stack code ;</p>
<pre><code>

#include &lt;M5Stack.h&gt;
#include &lt;M5StackUpdater.h&gt;

#define WIDTH 320
#define HEIGHT 240
#define BLOCK_SIZE  40
#define UNIT_WIDTH  5
#define UNIT_HEIGHT 5
#define UNIT_SIZE 25
#define GETX(i) ((i) % (5))
#define GETY(i) ((i) / (5))
int world[UNIT_SIZE];
int i;
  
void setup() {
  M5.begin();
  Wire.begin();
  if(digitalRead(BUTTON_A_PIN) == 0){
    Serial.println("Will load menu binary");
    updateFromFS(SD);
    ESP.restart();
  }
  Serial2.begin(115200, SERIAL_8N1, 16, 17);
  M5.Lcd.fillScreen(BLACK);
  M5.Lcd.setTextSize(2);
  M5.Lcd.setCursor(35, 220);  
  M5.Lcd.println("  &lt;       *       &gt;");  
    for (i = 0; i &lt; UNIT_SIZE; i++) {
    world[i] = 0;
  }
  i = UNIT_SIZE / 2;
}

void loop() {
      M5.update();
      int x = GETX(i) + 1;
      int y = GETY(i);
      if (world[i] &gt; 0) M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, LIGHTGREY);
      else M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, BLUE);
      if (M5.BtnC.wasPressed()) {
         if (world[i] &gt; 0) M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, WHITE);
         else M5.Lcd.fillRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, BLACK);
         ++i;
         if (i &gt;= UNIT_SIZE) i=0;
      }
      if (M5.BtnA.wasPressed()) {
         if (world[i] &gt; 0) M5.Lcd.fillRect(x * BLOCK_SIZE + 1, y * BLOCK_SIZE + 1, BLOCK_SIZE - 2, BLOCK_SIZE - 2, WHITE);
         else M5.Lcd.fillRect(x * BLOCK_SIZE, y * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE, BLACK);
         --i;
         if (i &lt; 0 ) i=UNIT_SIZE -1;
      }
      if (M5.BtnB.wasPressed()) {
        if (world[i] &gt; 0) world[i]=0;
        else world[i]=1;
        Serial2.print(world[i]);
        Serial2.print(GETX(i));
        Serial2.println(GETY(i));
      }
}
</code></pre>
<p dir="auto">On the M5; button A moves left, button C moves right and button B toggles the led, this shows on Micro-Bit and M5</p>
]]></description><link>https://community.m5stack.com/topic/1559/m5-bit-micro-bit-part-2</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Mar 2026 08:01:52 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1559.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Dec 2019 19:47:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to M5-bit (Micro-Bit)  part 2 on Mon, 30 Dec 2019 00:21:25 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/443">@ajb2k3</a> <img src="/assets/uploads/files/1577665245401-image1-resized.jpg" alt="0_1577665242771_Image1.jpg" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1577665258871-image2-resized.jpg" alt="0_1577665257165_Image2.jpg" class=" img-fluid img-markdown" /><br />
<img src="/assets/uploads/files/1577665275715-image3.jpg" alt="0_1577665274871_Image3.jpg" class=" img-fluid img-markdown" /></p>
]]></description><link>https://community.m5stack.com/post/6806</link><guid isPermaLink="true">https://community.m5stack.com/post/6806</guid><dc:creator><![CDATA[ChrisWR]]></dc:creator><pubDate>Mon, 30 Dec 2019 00:21:25 GMT</pubDate></item><item><title><![CDATA[Reply to M5-bit (Micro-Bit)  part 2 on Sun, 29 Dec 2019 08:41:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/2314">@chriswr</a> I understand that it make code for the microbit but i was hoping you would consider using m5stacks uiflow for the m5stack products just to be consistant.</p>
<p dir="auto">Apart from this, nice work and please keep sharing!</p>
]]></description><link>https://community.m5stack.com/post/6799</link><guid isPermaLink="true">https://community.m5stack.com/post/6799</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sun, 29 Dec 2019 08:41:23 GMT</pubDate></item><item><title><![CDATA[Reply to M5-bit (Micro-Bit)  part 2 on Sat, 28 Dec 2019 21:53:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/443">@ajb2k3</a> Its not uiflow, its makecode (for micro-bit) and arduino for m5</p>
]]></description><link>https://community.m5stack.com/post/6795</link><guid isPermaLink="true">https://community.m5stack.com/post/6795</guid><dc:creator><![CDATA[ChrisWR]]></dc:creator><pubDate>Sat, 28 Dec 2019 21:53:13 GMT</pubDate></item><item><title><![CDATA[Reply to M5-bit (Micro-Bit)  part 2 on Sat, 28 Dec 2019 08:09:09 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/2314">@chriswr</a> said in <a href="/post/6788">M5-bit (Micro-Bit) part 2</a>:</p>
<blockquote>
<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/187">@world101</a> ok, thx</p>
</blockquote>
<p dir="auto">Much better.<br />
Is the a uiflow blocky version of you latest code?</p>
]]></description><link>https://community.m5stack.com/post/6789</link><guid isPermaLink="true">https://community.m5stack.com/post/6789</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sat, 28 Dec 2019 08:09:09 GMT</pubDate></item><item><title><![CDATA[Reply to M5-bit (Micro-Bit)  part 2 on Sat, 28 Dec 2019 03:59:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/187">@world101</a> ok, thx</p>
]]></description><link>https://community.m5stack.com/post/6788</link><guid isPermaLink="true">https://community.m5stack.com/post/6788</guid><dc:creator><![CDATA[ChrisWR]]></dc:creator><pubDate>Sat, 28 Dec 2019 03:59:59 GMT</pubDate></item><item><title><![CDATA[Reply to M5-bit (Micro-Bit)  part 2 on Fri, 27 Dec 2019 13:28:24 GMT]]></title><description><![CDATA[<p dir="auto">This is great, but could you please format your code correctly when posting so we can read it? You do that by pasting your code <strong>enclosed</strong> within three back ticks (```) on the same line or separate lines.</p>
<p dir="auto"><code>like this</code>  or</p>
<pre><code>like this
</code></pre>
]]></description><link>https://community.m5stack.com/post/6781</link><guid isPermaLink="true">https://community.m5stack.com/post/6781</guid><dc:creator><![CDATA[world101]]></dc:creator><pubDate>Fri, 27 Dec 2019 13:28:24 GMT</pubDate></item></channel></rss>