Running Arduino code in browser – Wasmino #Arduino #WebAssembly

Wasmino is an Arduino core fully compatible with the Arduino IDE. It allows you to compile your Arduino sketch to WebAssembly and run it in a browser, all using the Arduino IDE.
Some caveats:
The Wasmino should be viewed as having an infinitely fast CPU, and operations other than
delayanddelayMicrosecondsdo not take any CPU time. Calling time functionsmicrosandmillisshould reflect this. IO can only happen during sleep, therefore you cannot do
1while (!digitalRead(2)) {} // this will hang the browser taband should do this instead
123while (!digitalRead(2)) {delay(50);}Having a infinitely fast CPU also means that interrupts will only happen during
delayanddelayMicroseconds. It is still good practice to usenoInterruptsandinterruptsto protect critical sections if you plan to use your code on real hardware.Other caveats exist such as the lack of
BUILTIN_LEDmacro since Wasmino, being virtual, doesn’t have a built-in LED.
The Wasmino Arduino core is available at https://github.com/wasmino/wasmino-core.
The runtime is also available at https://github.com/wasmino/wasmino-runtime.
More on Yifan Gu’s Blog
Post a Comment