pxt-calliope/docs/device/simulator.md
Juri Wolf 77ed2ccfb1
V4 updates (#210)
* update pxt.json files

* Fix button event enums

fixes https://github.com/microsoft/pxt-calliope/issues/206

* Fix Safari CSS Rule for iOS app

fixes https://github.com/microsoft/pxt-calliope/issues/205

* aprove preffered repos

should fix https://github.com/microsoft/pxt-calliope/issues/167
2023-01-11 09:51:27 -08:00

816 B

Simulator

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.

input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
   basic.showString("A");
});
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
   basic.showString("B");
});
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Click), () => {
   basic.showString("0");
});
input.onPinTouchEvent(TouchPin.P1, input.buttonEventValue(ButtonEvent.Click), () => {
   basic.showString("1");
});
input.onPinTouchEvent(TouchPin.P2, input.buttonEventValue(ButtonEvent.Click), () => {
   basic.showString("2");
});
input.temperature()
input.compassHeading()
input.lightLevel()