Sample code using stmhal port of mpkernel

boilerplate code for setup


In [1]:
# Setup Code
import sys!!
sys.path.append('/Users/User/dev/micropython/tools')!!
import pyboard!!
pyb = pyboard.Pyboard('/dev/tty.usbmodem1422')!!

In [2]:
pyb.enter_raw_repl()!!

In [ ]:
pyb.exit_raw_repl()!!

micropython code section:


In [9]:
# Blink an LED
import pyb
for x in range(10):
    pyb.LED(1).toggle()
    pyb.delay(500)


Out[9]:
(b'', b'')

In [23]:
print("hello world")


Out[23]:
(b'hello world\r\n', b'')

In [16]:
# TIM Example
tim = pyb.Timer(1, freq=1000)
tim.counter()
tim.freq(0.5)
tim.callback(lambda t: pyb.LED(1).toggle())


Out[16]:
(b'', b'')