Never programmed anything in your life? No need to worry! We selected the m5stickC+ because it caters to both the programming maniacs and the complete newbies. There are THREE kinds of languages you can use to build your own programs:

  • Blockly – drag and drop blocks into place on your screen and that’s all it takes! Very similar to Scratch, this approach was designed to teach children 6 years and older how to program, and focuses on logical thinking. If you can think in a linear progression (1 goes before 2 goes before 3), you can program with Blockly.
  • Micropython – if you’re a bit more advanced and have seen text-based languages before, you can immediately translate from Blockly to Micropython and code away. Same format as Python 3, but a very efficient syntax, and allows you to code things not immediately available in Blockly.
  • Arduino – if you’ve used an Arduino or another ESP32 style chip, you can connect and code directly from an Arduino IDE. We won’t go this far at Shad, but you’re welcome to do so individually – this will allow you to unlock features like Bluetooth connectivity, IR communications, use the Microphone, and tap into a TON of programs that others have already developed and are available online. Note however – if you program with Arduino, you will overwrite the Blockly/micropython firmware, which will need to be reflashed – we suggest experimenting with this only AFTER the program.

Here’s the big secret. But shhh… don’t tell anyone, it’ll destroy Chris’ street cred.

Chris (who has multiple advanced degrees in Engineering, has won many awards in highly technical fields, and holds a Canada Research Chair), only knows how to code these devices in Blockly, and that’s all he’s needed to create the programs you’re using so far. The language really doesn’t matter, compared to what you choose to do do with it.

Your devices have been pre-programmed to work with both Blockly and Micropython, and writing and uploading code is easy. Try these simple steps to program it yourself, everything provided.


Step 1: Set your device to be programmed

Reset your device, go to Settings (press A), select the “Code” page. You’ll see the following screens:

Settings page after reset (press A!)
Select code screen (press A)
Device connects to your wifi network
Device connecting to UI Flow server
Ready to program over Wifi on UI Flow!

Step 2: Load up the programming platform

Go to http://flow.m5stack.com – that’s correct, it’s right in your browser, no downloading anything! You may want to bookmark that site. UI Flow allows you to program your devices with Blockly or Micropython. When you first visit the page you’ll see:

Type in the 8 character API Key from your m5stickC screen into the “Api key” field above. In my example, I would type in FD4B4868.

Select the ORANGE m5stickC under “Device”.

Click OK.

You’re in! Check out the green “Connected” text on the bottom left of your screen – the browser is ready to “talk” to your m5stick.

There’s lots of stuff on this screen, but don’t worry about that – we’ll get there! If you’re the kind of person who must know RIGHT NOW, then you can click here, but otherwise feel free to carry on.

Step 3: Load some code!

Here’s a very simple program – it’ll turn the light on your m5stickC on and off every half second. Download the file here: FlashLED.m5f

In UI Flow, check out the bottom left panel again:

Click the second-last icon (Load the m5), and upload the FlashLED.m5f file that you just downloaded. The program should load in the main window. Just a few lines of code!

Now check out the top right panel:

And note the third-last icon. The triangular “play” button (RUN) will temporarily run the code on your m5stick (it will be saved as a temp.py file). You can use this repeatedly, and it’s very useful especially when testing code..

Et voila! Flashing lights on your m5stick

Alternatively, if you want to permanently save your code to the m5stick, hit the 2nd last icon (DOWNLOAD) button. This will transfer the code to your APPlist, exit the coding mode, reset the device, and run the new program. To program something new, you will have to go back to Step 1.

And that’s all there is to it!!!

Recap: in 3 steps and just a few minutes, you were able to do what used to take computer programmers the better part of a few weeks to pull off. Hmm… what else might you do? Check out the Tutorials and Projects pages for some ideas. And when you try something out, even if it’s small, help others learn from what you did! Email it to Chris (chris.moraes@mcgill.shad.ca) along with a short description to add to the “Projects” page!

Troubleshooting

  • UI Flow does not show me the green “Connected” sign!
    • Make sure your m5stick is turned on, and in “Code” mode.
    • Make sure the API key is correctly entered on UI Flow
    • Hit the “Refresh device status” button next to the Disconnected sign
  • If your device has somehow been reset (high magnetic field, etc), you may need to reflash the firmware. Instructions available at this post.

Some warnings

WARNING #1: these devices are really robust, and it is VERY difficult to damage them, as long as you are using Blockly and Micropython languages. For this reason, we recommend using only the UI Flow programming language during Shad. After the program is completed, feel free to explore other options!

WARNING #2: There’s lots of accessories you can plug into the m5stickC, but we recommend waiting patiently until the program begins before we coach you through that. Incorrectly plugging in a wire can damage your device, and we don’t want that to happen before Shad.