The new life of Flappy-Bird, coding with MicroPython !
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
Yes you read right ! There is no mistake, it's no "Flappy Bird", but "Flappy-thon" in tribute to the fabulous programming language : Python (and also for the game). You can read that 'Flap-python', but you'll understand why I split the name like that !
Development tools used :
- STM32F407DISC1 development card
⚠️ LIS3DSH NECESSARY (or you need to modify the code)⚠️ - MicroPython
- Linux
- Visual Studio
- Git and GitHub 🙂
- How we say "Tuna fish" in French ?
- We say "Thon"
Here we go, after this unbelivable French course, you know why the game name is "Flappy-Thon"
If you are interested in this game, follow these steps to download all necessary dependencies ! (I explain how I do with an STM32F407G discovery board.)
Don't forget to click the "star button"
- Clone the repo to your local computer
or
git clone git@github.com:your_username/Flappy-thon.git
git clone https://github.com/your_username/Flappy-thon.git
First of all, you need to install microPython. For it, go to this page : https://micropython.org/download/
In this same page, you'll find all the boards accepted by microPython, so check if one of this is disponible in your lab ! For the user interface I used an accelerometer (LIS3DSH present on the board), so if you don't want to modify the code, you must have the same accelerometer in the system. 🙂
(if you're a crazy developer, I'm sorry but I will not explain the next steps for """windows lovers""".)
Personnaly, I worked on an STM32F407G DISC1 board for this project, and I flashed the board with DFU. You can also use the classic ST-LINK for STBoard (https://micropython.org/download/STM32F4DISC/).
For this board, you need to connect VDD and BOOT pins with a jumper, and use a mini USB cable for the card alimentation, and a micro USB cable for the flashing part.
- pydfu.py file : https://github.com/micropython/micropython/blob/master/tools/pydfu.py
- firmware : https://micropython.org/download/STM32F4DISC/ (at the bottom of this page)
Activate a virtual environment with the command :
source venv/bin/activate
Don't forget to connect the board
Returns a list of USB devices which are currently in DFU mode :
python pydfu.py --list
Flash the board:
python pydfu.py --upload [_name_of_the_firmware_download_before_].dfu
Exemple of result (file name depends of the choosen firmware):
File: STM32F4DISC-20220117-v1.18.dfu
...
...
Zxiting DFU...
Finished
The flashing part is terminated. Now you need to copy your python files into the board (you can use the tool file for this).
Now, you can start a microPython terminal :
sudo screen /dev/ttyACM0
The REPL mode is launched...
To start the program, import the file "flappython.py".
>>> import flappython
Don't forget to modify this file with your user name You can use tool file for copying and umount correctly the board before test it.
sudo bash cp_project.sh
- Official documentation for microPython : https://docs.micropython.org/en/latest/index.html
- GitHub microPython :https://github.com/micropython/micropython
Distributed under the MIT License. See LICENSE.txt
for more information.