MicroPython#

The {exec} micropython directive allows uploading and executing Python code on an embedded system running MicroPython.

Generic#

name = input("What's your name? ")
print("Hello, %s!" % name)

BBC micro:bit V2#

from microbit import *
import time

display.on()
for name in dir(Image):
  if not name[0].isupper() or name.startswith('ALL_'): continue
  print(name)
  display.show(getattr(Image, name))
  time.sleep(0.5)

Raspberry Pi Pico#

from machine import Pin
import time

led = Pin("LED", Pin.OUT)

for i in range(10):
  led.toggle()
  time.sleep(0.4)