Microcontroller

What it is

mcu.o.se is the machine as an Arduino-core library, with classes for the ESP32, the ESP32-S3 and the Particle Photon 2. A sketch instantiates one, and the board is a host. Modules are linked in, and the /o/ vocabulary is bound as C pointers rather than as programs, to fit. The repository is MicrOSCript.

Get it running

With arduino-cli, compile against the copy in your clone:

arduino-cli compile --library "$PWD/hosts/mcu.o.se" \
    --fqbn <your board> hosts/mcu.o.se/examples/PlatformAgnostic/CreateBundle

The Arduino IDE only looks in ~/Documents/Arduino/libraries, so for the IDE put a symlink there pointing at hosts/mcu.o.se. Each networked example takes its SSID and password from an arduino_secrets.h in its own directory (examples/ESP32/ESP32WiFiUDPEval/, examples/ESP32-S3/InnerMachineUDP/); copy the arduino_secrets.h.example there and fill it in. As a standalone clone, the library is the repository itself.

First program

Flash examples/PlatformAgnostic/CreateBundle: no network, no secrets. It makes a machine in 2 KB, pushes two messages into it once a second, and prints the bundle’s size on the serial console at 115200 baud (arduino-cli monitor -p <port> -c baudrate=115200). Then examples/ESP32-S3/ESP32S3WiFiUDPEval: the board joins your WiFi, prints its address, and runs osen sent to UDP 8888.

What it adds

Into the host register: pins (/digital/pinmode, /digital/read, /digital/write, /digital/sample, /analog/read, /analog/sample), the radio (/wifi/addr/ip, /wifi/addr/mac, /udp/sendto, /udp/port/listening) and the console (/serial/println, /print, /println).