Here you will soon find a short post about my first experiences with the BADGER 2040. This is a low-cost, credit card sized board that you can buy here for GBP 16.50. The Badger combines the Raspberry Pi RP2040 controller with a nice electronic ink display. You can use either C/C++ or MicroPython as programming languages.

A first photo

An easy way to create programs is to use the Thonny editor. This editor is quite versatile, it has a REPL (Read-eval-print-loop), so you can send Python commands directly to the BADGER and they will be executed. This is a nice way to try out code snippets.

Normally you will put your code into a file and then transfer it to the BADGER. The Thonny editor also allows you to view the files on the controller and those on your computer, so it is easy to move files forth and back within the editor. The editor will also highlight any syntax and runtime errors you make.

In order to familiarise yourself with Thonny and the BADGER, just follow the Tutorial. Here are some further remarks:

  • You need to connect the BADGER to your computer. The USB socket on the BADGER is rather fragile, so please always hold a thumb on the socket when you connect/disconnect a USB cable. Furthermore, always use straight movements, do not bend or wiggle the connector as the socket may break off the board.
  • You can find the code examples in a GitHub repository. A good way to get to know the BADGER and MicroPython is to read and understand existing code, modify the program and then run it to check if you get the desired outcome. In addition to the examples, you may need a bit of knowledge of Python and the MicroPython libraries being used. There are some lower level libraries/modules that are documented here and some BADGER specific libraries that are described here. The import statement at the beginning of a file will let you know where you have to look for. “import time” as an example means that functions of a module with the name time are being used, you find its description in the documentation for the MicroPython language. Below is a screenshot from the documentation. The example here shows functions in module time, they allow to delay execution or get timing information.
  • If you want to get some more information about the controller, this may be a suitable site to get it.
  • For the last examples of the tutorial you need to reformat a photo. You can find a short description on how to do that on a Windows machine here.
  • Once you have finished your work, please do not forget to back up your files. If you have a GitHub account, you can also create a new repository and drag and drop the files there.

One more example, next step to your own programs …

So far you have only used the interactive REPL to enter code, upload it to the BADGER and then run the code. Normally you save your code in a file, then upload and run it on your machine, in our case the BADGER. The following file makes the LED on board of the BADGER blink. Create a new file using the green plus symbol in Thonny, and enter the 9 lines of code. In Python indentations need to be respected, they are part of the syntax. Once you are finished, click the round green button with the white flash. This will upload the file and run it.