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
This commit is contained in:
@ -38,7 +38,7 @@ Each time the crocodile clip is firmly connected and disconnected from pin `P0`,
|
||||
the @boardname@ will return a random Number between 0 and the parameter limit.
|
||||
|
||||
```blocks
|
||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
||||
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
basic.showNumber(randint(0, 10))
|
||||
})
|
||||
```
|
||||
|
@ -63,7 +63,7 @@ for (let i = 0; i < values.length; i++) {
|
||||
The ``||led:plot bar graph||`` also sends the number value it's plotting to the console. You can see the output in the Data Viewer. It charts the values and they appear as individual numbers in console.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
for (let i = 0; i < 25; i++) {
|
||||
if (i % 2 > 0) {
|
||||
led.plotBarGraph(0, 0)
|
||||
|
@ -51,7 +51,7 @@ The first job of the scheduler is to allow multiple *subprograms* to be queued u
|
||||
```typescript
|
||||
let count = 0
|
||||
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count++;
|
||||
})
|
||||
|
||||
@ -74,7 +74,7 @@ The second statement informs the scheduler that on each and every event of the *
|
||||
// statement 1
|
||||
let count = 0
|
||||
// statement 2
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count++;
|
||||
})
|
||||
```
|
||||
@ -85,7 +85,7 @@ The third statement queues a `forever` loop for later execution by the scheduler
|
||||
// statement 1
|
||||
let count = 0
|
||||
// statement 2
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count++;
|
||||
})
|
||||
// statement 3
|
||||
@ -157,7 +157,7 @@ As a result, you can easily add a new capability to the micro:bit by just adding
|
||||
```typescript
|
||||
let count = 0
|
||||
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count = count + 1
|
||||
})
|
||||
|
||||
@ -165,7 +165,7 @@ basic.forever(() => {
|
||||
basic.showNumber(count)
|
||||
})
|
||||
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count = 0
|
||||
})
|
||||
```
|
||||
|
@ -6,7 +6,7 @@ The code below shows a simple script that sends a line when the BBC micro:bit st
|
||||
|
||||
```blocks
|
||||
serial.writeLine("started...")
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
serial.writeLine("A pressed")
|
||||
})
|
||||
```
|
||||
|
@ -4,19 +4,19 @@ The JavaScript simulator allows you to test and execute most BBC micro:bit progr
|
||||
It allows you to emulate sensor data or user interactions.
|
||||
|
||||
```sim
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("A");
|
||||
});
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("B");
|
||||
});
|
||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
|
||||
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("0");
|
||||
});
|
||||
input.onPinTouchEvent(TouchPin.P1, ButtonEvent.Click, () => {
|
||||
input.onPinTouchEvent(TouchPin.P1, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("1");
|
||||
});
|
||||
input.onPinTouchEvent(TouchPin.P2, ButtonEvent.Click, () => {
|
||||
input.onPinTouchEvent(TouchPin.P2, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("2");
|
||||
});
|
||||
input.temperature()
|
||||
|
Reference in New Issue
Block a user