The JavaScript simulator allows you to test and execute most BBC micro:bit programs in the browser. It allows you to emulate sensor data or user interactions. Show This project is a fork of the Mbed Simulator that has been modified in order to simulate the BBC micro:bit in browser using Emscripten. The project has been stripped down to the necessary parts and Javascript added to simulate
micro:bit specific peripherals. The simulator is currently used to run MicroPython scripts in browser, which is used by the MicroPython Editor. The simulator currently requires Docker and Node to build. If using Linux you may also need to follow the instructions under "Manage Docker as a non-root user" to prevent docker requiring After cloning the repository, run the following commands to build:
If you want to force a
rebuild of the image, run If you want to reset all cloned repositories to their initial state, run TestingFollow the testing instructions in the MicroPython simulator README. Integrating the simulatorAn example of using the simulator within another web page is the BBC micro:bit Python Editor. The .js and .wasm files in /micropython-simulator/BUILD/SIMULATOR/ are copied over, along with the /viewer directory. The simulator is contained within an iframe like so Changes made to the simulator were as follows:
When containing the simulator in an iframe, the following functions must be implemented in the parent window:
The Code of ConductTrust, partnership, simplicity and passion are our core values we live and breathe in our daily work life and within our projects. Our open-source projects are no exception. We have an active community which spans the globe and we welcome and encourage participation and contributions to our projects by everyone. We work to foster a positive, open, inclusive and supportive environment and trust that our community respects the micro:bit code of conduct. Please see our code of conduct which outlines our expectations for all those that participate in our community and details on how to report any concerns and what would happen should breaches occur. |