Repository with the code and slides for my tutorial at PyCon US 2024.
In this tutorial you'll learn how to use the resources of the BBC micro:bit, an open source embedded device that lets you control electronic components using MicroPython. Some of the components you'll learn to use in this tutorial include:
- Push buttons
- 5x5 LED matrix
- Accelerometer sensor
- Radio communication.
The goal of the tutorial is to implement a version of the Battleship game that can be controlled using the accelerometer sensor.
This repository contains all the code avaiable in the slides, as well as the code for the exercises and projects.
The file cheat_sheet.py has code examples for all the components we'll use in the tutorial.
During the tutorial we'll be going over some interactive examples that are available in the examples folder. Feel free to run them on the micro:bit to see how they work and change it to see the effects.
The tutorial has two projects: a single-player version and a multiplayer version of the Battleship game.
single.player.mov
Use the template files available in the folder battleship-single-player to fill the gaps during the tutorial.
- Template 1: Study the class
Ship
- Template 2: Fill the
shoot
method in classPlayer
- Template 3: Complete the class
Game
The final code for the single-player version of the game is available in the file single-player-complete.py.
multiplayer.mp4
Use the template files available in the folder battleship-multiplayer to fill the gaps during the tutorial.
- Template 1: Complete the multiplayer aspects of the class
Game
The final code for the multi-player version of the game is available in the file multiplayer-complete.py.
The slides for this tutorial are available in the file slides.pdf.