77ed2ccfb1
* 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
26 lines
816 B
Markdown
26 lines
816 B
Markdown
# 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.
|
|
|
|
```sim
|
|
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()
|
|
```
|