We were bored and made a little project using MicroPython.
This project was never supposed to be a big project, but community feedback would be appreciated.
MicroBit chip can't read python code, but it can read hex code. This python code is translated into hex code using this python to hex converter.
That converter has already microbit module installed so it is our go-to.
We use heavy OOP style of code for this project while not being oversimplified.
class Frog():
def __init__(self, x):
self.x = x
self.y = 4
self.brightness = 7
self.isAlive = True
display.set_pixel(self.x, self.y, self.brightness)
def strafe(self, pos):
display.set_pixel(self.x, self.y, 0)
if self.x < 4 and pos == "right":
self.x += 1
if self.x > 0 and pos == "left":
self.x -=1
display.set_pixel(self.x, self.y, self.brightness)
def die(self):
#global score
self.isAlive = False
display.scroll("u ded fam")
display.scroll("score : " + str(score))
display.clear()
We are facing a big problem where after 25 cars have passed, the chip runs out of RAM memory and the program raises MemoryError
.
Every single feature is implemented through classes or functions.
Micropython doesn't support async module.
There aren't any tests need at the moment, but manual tests are really important.
For this project, everything above Python 3.6 will be absolutely fine. Take a look here about micropython and it's features and limitations.
We use a mixture of pylint and flake8 for linting. To contribute, fork this repo, add yourself to contributors list, make changes and submit PR. Feel free to open issues, we are glad to hear feedback.
MIT © Saki