Examples

The same language on a microcontroller

The whole of examples/blink.zeno, and what zeno run prints for it.

blink.zeno
# blink.zeno: the same language on a microcontroller.
#
#     zeno run examples/blink.zeno       run it on the simulated board (stop it with Ctrl-C)
#     zeno build --firmware --no-collector examples/blink.zeno
#                                        compile it to blink.c: three lines of C in a loop
#
# On a computer the board is simulated and prints `led on`, `led off`.
# docs/board.md shows how a real board is put underneath.

from board import led
from time import sleep

while true {
    led.toggle()
    sleep(500 ms)        # units are part of the number, so 500 ms + 3 V is an error
}
zeno run examples/blink.zeno
led on
led off
led on
led off
led on
led off

This program runs until it is stopped. The first 24 lines are shown.

See it on GitHub: examples/blink.zeno.