Jacob Astar

Camp Counselor

Intro to Embedded Rust with Micro:bit

Event Logo

Monday, July 29, 2024 - 2:00 PM UTC, for 4 hours.

Workshop (pre-conference)

Room: African 20

Rust
micro:bit
EmbeddedProgramming
IoT

Boasting fast execution performance, effective memory and thread safety, along with easy tooling for increased developer productivity, Rust is currently one of the fastest growing programming languages. One area where Rust really shines is embedded devices due to its ability to interact with hardware at a low-level, while retaining the usability of a high-level language. In this session, we’ll start off with the basics of Rust syntax… standard types, custom structs, functions, and Rust’s package management system, Cargo. Once we have a good handle on these, we’ll move on to learning how we can use the BBC micro:bit V2; a small microprocessor with several built-in sensors, buttons, and a 5x5 LED array. We’ll then cover how to prep and compile our code before flashing it onto the micro:bit. Lastly, we’ll put all of these topics together in order to create a simple game similar to minesweeper. This game will use the built-in buttons for navigation and selection, and display our interaction with the minefield on the micro:bit’s LED array. This session isn’t meant to make someone an expert at Rust or embedded programming. Rather, it’s purpose is to show folks that are new to one or both topics what Rust is capable of, why it's great for embedded programming, and to demonstrate that anyone can get started with it in just 4 hours.

Agenda

* First hour or so: Intro to Rust syntax and language features. * Next thirty minutes: Getting familiar with embedded programming, and the BBC micro:bit V2. Learning how to compile code, flash it to the board and interact with LED and buttons. * Remaining time: Building our game...calculating mine locations, taking in the actions of the buttons, displaying the results on the LED Array.

Prerequisites

Rust will be pretty familiar if you come from other statically-typed languages, however, no programming experience is required for this workshop. We will start from zero! Note: I will bring at least 10 micro:bit V2's for participants to use during the session, however, you are more than welcome to bring your own if you'd like. The "Go Kits", which include the micro:bit, a battery holder, and USB cable, are roughly $20 and can commonly be found at stores like Amazon, Microcenter, Parallax, etc. You'll want to make sure you are getting the V2 version as the V1 has different sensors and a smaller LED array. I'll include several links for purchase in the resource section below. Reminder, having your own is totally optional as I will have some for folks to use during the session!

Take Aways

  • What embedded programing is
  • Basic syntax for the Rust programming language
  • How to compile code and flash it to a micro:bit microcontroller
favorited by:
Erica Stanley Josh Gretz Robert Derman