hp
toc

Microcounter

2016-09-24, post № 142

MicroPython, programming, Python 3, #micro, #microcontroller, #pyboard

Being a big fan of Python [1], I recently got a MicroPython Board.
MicroPython is a simple to use micro controller which runs Python 3. To put code onto it, you simple mount it as you would do with a USB flash drive, copy your main.py to it and restart your MicroPython.
As a simple “Hello world.”-program, I wrote this counting script. Every time you press the built-in [2] button, it counts up by one. Using the four built-in LEDs and binary number representation, this counter can count from 𝟢 to 𝟣𝟧 and then wraps back.

microcounter.gif
Source code: microcounter.py

Footnotes

  1. [2020-07-20] That sentiment has changed.
  2. [2020-07-20] Or rather “built-on”?
Jonathan Frech's blog; built 2024/08/31 22:59:44 CEST