Compare commits

...

8 Commits

Author SHA1 Message Date
Juri Wolf
b0af4b54b2
Remove extensions without MIT License (#215)
Replaces `dl1ekm/pxt-calliope-PCF85063-RTC` by `CalliTGS3/pxt-calliope-grovePCF85063TP` and removes `dl1ekm/pxt-calliope-ADS1x15`
2023-01-16 20:12:24 -08:00
Richard Knoll
5aade18a66 4.0.30 2023-01-11 10:06:18 -08:00
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
Richard Knoll
1aaedf1fa0
bump pxt-core to hopefully fix karma tests (#211)
* bump pxt-core to hopefully fix karma tests

* bump again

* update node version
2023-01-10 15:49:30 -08:00
Juri Wolf
6a5d25197b
release v4.0.29 to life (#203) 2022-09-23 09:17:45 -07:00
Juri Wolf
6d4b2185b4
Updates localization (#202)
* Updated translation

Updated translation

* Updated localization

Updated localization

* Fixed typos

Fixed typos

* Updated localization

Updated localization

Co-authored-by: Jørn Alraun <ja@urbn-pockets.com>
2022-09-23 08:45:02 -07:00
Richard Knoll
5a1ba75dc9 4.0.29 2022-09-19 09:22:30 -07:00
Richard Knoll
b4f625d44c
Bump pxt-core reference to latest stable7.0 (#201) 2022-09-16 09:34:09 -07:00
69 changed files with 285 additions and 226 deletions

View File

@ -14,7 +14,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [8.x] node-version: [18.x]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1

View File

@ -9,7 +9,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [8.x] node-version: [18.x]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1

View File

@ -14,7 +14,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [8.x] node-version: [18.x]
steps: steps:
- uses: actions/checkout@v1 - uses: actions/checkout@v1

View File

@ -26,12 +26,12 @@ The Calliope mini is packaged with sensors, radio and other goodies. Learn about
You can program the Calliope mini using [Blocks](/blocks) or [JavaScript](/javascript) in your web browser via the [Calliope mini APIs](/reference): You can program the Calliope mini using [Blocks](/blocks) or [JavaScript](/javascript) in your web browser via the [Calliope mini APIs](/reference):
```block ```block
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showString("Hi!"); basic.showString("Hi!");
}) })
``` ```
```typescript ```typescript
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showString("Hi!"); basic.showString("Hi!");
}) })
``` ```
@ -54,7 +54,7 @@ The simulator has support for the LED screen, buttons, as well as compass, accel
basic.forever(() => { basic.forever(() => {
basic.showString("Hi!"); basic.showString("Hi!");
}) })
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
led.stopAnimation(); led.stopAnimation();
basic.showLeds(` basic.showLeds(`
. . . . . . . . . .
@ -63,7 +63,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
# . . . # # . . . #
. # # # .`); . # # # .`);
}); });
input.onButtonEvent(Button.B, ButtonEvent.Down, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
led.stopAnimation(); led.stopAnimation();
basic.showLeds(` basic.showLeds(`
. # . # . . # . # .

View File

@ -17,7 +17,7 @@ if (led.point(1,1) && led.point(2,2)) {
When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below: When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below:
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
let x = randint(0, 5) let x = randint(0, 5)
if(x < 5) { if(x < 5) {
basic.showString("low"); basic.showString("low");

View File

@ -7,7 +7,7 @@
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed: If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed:
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
if(input.lightLevel()<100){ if(input.lightLevel()<100){
led.setBrightness(255); led.setBrightness(255);
} }

View File

@ -7,7 +7,7 @@
This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen. This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
for(let i = 0; i < 5; ++i) { for(let i = 0; i < 5; ++i) {
basic.showNumber(i) basic.showNumber(i)
} }

View File

@ -7,7 +7,7 @@
The following example uses a while loop to make a diagonal line on the LED screen (points `0, 0`, `1, 1`, `2, 2`, `3, 3`, `4, 4`). The following example uses a while loop to make a diagonal line on the LED screen (points `0, 0`, `1, 1`, `2, 2`, `3, 3`, `4, 4`).
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
let index = 4; let index = 4;
while(index >= 0) { while(index >= 0) {
led.plot(index, index); led.plot(index, index);

View File

@ -5,7 +5,7 @@
In this example, ``on start`` sets a dimmer brightness on the screen and the button handler shows a string. In this example, ``on start`` sets a dimmer brightness on the screen and the button handler shows a string.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showString("Hello!") basic.showString("Hello!")
}) })
led.setBrightness(50) led.setBrightness(50)

View File

@ -59,7 +59,7 @@ A counter is a great example:
```blocks ```blocks
let counter = 0; let counter = 0;
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
counter = counter + 1; counter = counter + 1;
basic.showNumber(counter); basic.showNumber(counter);
}); });

View File

@ -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. the @boardname@ will return a random Number between 0 and the parameter limit.
```blocks ```blocks
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => { input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showNumber(randint(0, 10)) basic.showNumber(randint(0, 10))
}) })
``` ```

View File

@ -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. 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 ```blocks
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
for (let i = 0; i < 25; i++) { for (let i = 0; i < 25; i++) {
if (i % 2 > 0) { if (i % 2 > 0) {
led.plotBarGraph(0, 0) led.plotBarGraph(0, 0)

View File

@ -51,7 +51,7 @@ The first job of the scheduler is to allow multiple *subprograms* to be queued u
```typescript ```typescript
let count = 0 let count = 0
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
count++; count++;
}) })
@ -74,7 +74,7 @@ The second statement informs the scheduler that on each and every event of the *
// statement 1 // statement 1
let count = 0 let count = 0
// statement 2 // statement 2
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
count++; count++;
}) })
``` ```
@ -85,7 +85,7 @@ The third statement queues a `forever` loop for later execution by the scheduler
// statement 1 // statement 1
let count = 0 let count = 0
// statement 2 // statement 2
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
count++; count++;
}) })
// statement 3 // statement 3
@ -157,7 +157,7 @@ As a result, you can easily add a new capability to the micro:bit by just adding
```typescript ```typescript
let count = 0 let count = 0
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
count = count + 1 count = count + 1
}) })
@ -165,7 +165,7 @@ basic.forever(() => {
basic.showNumber(count) basic.showNumber(count)
}) })
input.onButtonEvent(Button.B, ButtonEvent.Down, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
count = 0 count = 0
}) })
``` ```

View File

@ -6,7 +6,7 @@ The code below shows a simple script that sends a line when the BBC micro:bit st
```blocks ```blocks
serial.writeLine("started...") serial.writeLine("started...")
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
serial.writeLine("A pressed") serial.writeLine("A pressed")
}) })
``` ```

View File

@ -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. It allows you to emulate sensor data or user interactions.
```sim ```sim
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("A"); basic.showString("A");
}); });
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("B"); basic.showString("B");
}); });
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => { input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("0"); basic.showString("0");
}); });
input.onPinTouchEvent(TouchPin.P1, ButtonEvent.Click, () => { input.onPinTouchEvent(TouchPin.P1, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("1"); basic.showString("1");
}); });
input.onPinTouchEvent(TouchPin.P2, ButtonEvent.Click, () => { input.onPinTouchEvent(TouchPin.P2, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("2"); basic.showString("2");
}); });
input.temperature() input.temperature()

View File

@ -22,13 +22,13 @@ Here's a program that simulates cell life in the LED matrix. Use button ``A`` fo
let lifeChart: Image = null let lifeChart: Image = null
//Use button A for the next iteration of game of life //Use button A for the next iteration of game of life
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
gameOfLife(); gameOfLife();
show(); show();
}) })
//Use button B for reseting to random initial seed state //Use button B for reseting to random initial seed state
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
reset(); reset();
show(); show();
}) })

View File

@ -1,3 +1,3 @@
{ {
"appref": "v3.0.33" "appref": "v4.0.29"
} }

View File

@ -11,7 +11,7 @@ Let's create a coin flipping program to simulate a real coin toss. We'll use ico
Get an ``||input:on button A pressed||`` block from the ``||input:Input||`` drawer in the toolbox. We'll put our coin flipping code in here. Get an ``||input:on button A pressed||`` block from the ``||input:Input||`` drawer in the toolbox. We'll put our coin flipping code in here.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
}) })
``` ```
@ -22,7 +22,7 @@ Grab an ``||logic:if else||`` block and set it inside ``||input:on button A pres
The ``||Math:pick random true or false||`` returns a random ``true`` or ``false`` value which we use to determine a ``heads`` or ``tails`` result for a coin toss. The ``||Math:pick random true or false||`` returns a random ``true`` or ``false`` value which we use to determine a ``heads`` or ``tails`` result for a coin toss.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
if (Math.randomBoolean()) { if (Math.randomBoolean()) {
} else { } else {
} }
@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
Now, put a ``||basic:show icon||`` block inside both the ``||logic:if||`` and the ``||logic:else||``. Pick images to mean ``heads`` and ``tails``. Now, put a ``||basic:show icon||`` block inside both the ``||logic:if||`` and the ``||logic:else||``. Pick images to mean ``heads`` and ``tails``.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
if (Math.randomBoolean()) { if (Math.randomBoolean()) {
basic.showIcon(IconNames.Skull) basic.showIcon(IconNames.Skull)
} else { } else {
@ -52,7 +52,7 @@ Press button **A** in the simulator to try the coin toss code.
You can animate the coin toss to add the feeling of suspense. Place different ``||basic:show icon||`` blocks before the ``||logic:if||`` to show that the coin is flipping. You can animate the coin toss to add the feeling of suspense. Place different ``||basic:show icon||`` blocks before the ``||logic:if||`` to show that the coin is flipping.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showIcon(IconNames.Diamond) basic.showIcon(IconNames.Diamond)
basic.showIcon(IconNames.SmallDiamond) basic.showIcon(IconNames.SmallDiamond)
basic.showIcon(IconNames.Diamond) basic.showIcon(IconNames.Diamond)

View File

@ -11,7 +11,7 @@ Make a love meter, how sweet! The @boardname@ is feeling the love, then sometime
Let's build a **LOVE METER** machine. Place an ``||input:on pin pressed||`` block to run code when pin **0** is pressed. Use ``P0`` from the list of pin inputs. Let's build a **LOVE METER** machine. Place an ``||input:on pin pressed||`` block to run code when pin **0** is pressed. Use ``P0`` from the list of pin inputs.
```blocks ```blocks
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => { input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
}); });
``` ```
@ -20,7 +20,7 @@ input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from `0` to `100` when pin **0** is pressed. Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from `0` to `100` when pin **0** is pressed.
```blocks ```blocks
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => { input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showNumber(randint(0, 100)); basic.showNumber(randint(0, 100));
}); });
``` ```
@ -34,7 +34,7 @@ Show ``"LOVE METER"`` on the screen when the @boardname@ starts.
```blocks ```blocks
basic.showString("LOVE METER"); basic.showString("LOVE METER");
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => { input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showNumber(randint(0, 100)); basic.showNumber(randint(0, 100));
}); });
``` ```

View File

@ -12,7 +12,7 @@ Use ``||input:on button pressed||`` to send a text message over radio with ``||r
Every @boardname@ nearby will receive this message. Every @boardname@ nearby will receive this message.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
radio.sendString("Yo"); radio.sendString("Yo");
}); });
``` ```
@ -41,7 +41,7 @@ radio.onReceivedString(function (receivedString) {
Press button **A** on the simulator, you will notice that a second @boardname@ appears (if your screen is too small, the simulator might decide not to show it). Try pressing **A** again and notice that the "Yo" message gets displayed on the other @boardname@. Press button **A** on the simulator, you will notice that a second @boardname@ appears (if your screen is too small, the simulator might decide not to show it). Try pressing **A** again and notice that the "Yo" message gets displayed on the other @boardname@.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
radio.sendString("Yo"); radio.sendString("Yo");
}); });
radio.onReceivedString(function (receivedString) { radio.onReceivedString(function (receivedString) {

View File

@ -13,7 +13,7 @@ First, let's get your name to display on the screen.
From the ``||input:Input||`` Toolbox drawer, drag an ``||input:on button A pressed||`` block onto the Workspace. From the ``||input:Input||`` Toolbox drawer, drag an ``||input:on button A pressed||`` block onto the Workspace.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
}) })
``` ```
@ -23,7 +23,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
From the ``||basic:Basic||`` Toolbox drawer drag a ``||basic:show string||`` block into the ``||input:on button A pressed||`` block. From the ``||basic:Basic||`` Toolbox drawer drag a ``||basic:show string||`` block into the ``||input:on button A pressed||`` block.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
basic.showString("Hello!") basic.showString("Hello!")
}) })
``` ```
@ -33,7 +33,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
In the ``||basic:show string||`` block, type your name. In the ``||basic:show string||`` block, type your name.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
basic.showString("My Name") basic.showString("My Name")
}) })
``` ```
@ -43,7 +43,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
Go to the simulator and test your name badge by pressing button **A**. Go to the simulator and test your name badge by pressing button **A**.
```sim ```sim
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
basic.showString("My Name") basic.showString("My Name")
}) })
``` ```

View File

@ -123,7 +123,7 @@ basic.forever(function () {
**MakeCode blocks for the Robot Unicorn controller** **MakeCode blocks for the Robot Unicorn controller**
```blocks ```blocks
input.onButtonEvent(Button.AB, ButtonEvent.Down, function () { input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Down), function () {
radio.sendNumber(4) radio.sendNumber(4)
basic.showLeds(` basic.showLeds(`
# . . . # # . . . #

View File

@ -83,7 +83,7 @@ Now that we are detecting pulses, we can use a variable to count them too. In th
```blocks ```blocks
let pulseCount = 0 let pulseCount = 0
input.onButtonEvent(Button.A, ButtonEvent.Down, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), function () {
basic.showNumber(pulseCount) basic.showNumber(pulseCount)
pulseCount = 0 pulseCount = 0
}) })

View File

@ -12,7 +12,7 @@ Code the buttons on the @boardname@ to show that it's happy or sad.
Place a ``||input:on button pressed||`` block to run code when button **A** is pressed. Place a ``||input:on button pressed||`` block to run code when button **A** is pressed.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
}); });
``` ```
@ -21,7 +21,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen. Press the **A** button in the simulator to see the smiley. Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen. Press the **A** button in the simulator to see the smiley.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showLeds(` basic.showLeds(`
# # . # # # # . # #
# # . # # # # . # #
@ -37,7 +37,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowny when button **B** is pressed. Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowny when button **B** is pressed.
```blocks ```blocks
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showLeds(` basic.showLeds(`
# # . # # # # . # #
# # . # # # # . # #
@ -53,7 +53,7 @@ input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
Add a secret mode that happens when **A** and **B** are pressed together. For this case, add multiple ``||basic:show leds||`` blocks to create an animation. Add a secret mode that happens when **A** and **B** are pressed together. For this case, add multiple ``||basic:show leds||`` blocks to create an animation.
```blocks ```blocks
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => { input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showLeds(` basic.showLeds(`
. . . . . . . . . .
# . # . . # . # . .

View File

@ -59,7 +59,7 @@ Use a ``||input:on button pressed||`` block to handle the **A** button. Put in a
```blocks ```blocks
let sprite = game.createSprite(2, 2) let sprite = game.createSprite(2, 2)
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
if (sprite.get(LedSpriteProperty.X) == 2) { if (sprite.get(LedSpriteProperty.X) == 2) {
} else { } else {
} }
@ -77,7 +77,7 @@ Finally, pull out an ``||game:add score||`` and a ``||game:game over||`` block t
```blocks ```blocks
let sprite = game.createSprite(2, 2) let sprite = game.createSprite(2, 2)
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
if (sprite.get(LedSpriteProperty.X) == 2) { if (sprite.get(LedSpriteProperty.X) == 2) {
game.addScore(1) game.addScore(1)
} else { } else {

View File

@ -24,7 +24,7 @@ bluetooth.stopAdvertising();
## Example: stop advertising on button pressed ## Example: stop advertising on button pressed
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
bluetooth.stopAdvertising(); bluetooth.stopAdvertising();
}) })
``` ```

View File

@ -27,7 +27,7 @@ bluetooth.onBluetoothDisconnected(() => {
basic.showString("D"); basic.showString("D");
connected = 0; connected = 0;
}); });
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
if (connected == 1) { if (connected == 1) {
bluetooth.uartWriteLine("HELLO"); bluetooth.uartWriteLine("HELLO");
} }

View File

@ -27,7 +27,7 @@ bluetooth.onBluetoothDisconnected(() => {
basic.showString("D"); basic.showString("D");
connected = 0; connected = 0;
}); });
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
if (connected == 1) { if (connected == 1) {
bluetooth.uartWriteString("HELLO"); bluetooth.uartWriteString("HELLO");
} }

View File

@ -29,7 +29,7 @@ control.inBackground(() => {
basic.pause(100) basic.pause(100)
} }
}) })
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
num++; num++;
}) })
``` ```
@ -42,7 +42,7 @@ let num = 0
basic.forever(() => { basic.forever(() => {
basic.showNumber(num) basic.showNumber(num)
}) })
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
num++; num++;
}) })
``` ```

View File

@ -24,11 +24,11 @@ When you get tired of counting, press button `B` to reset the
```blocks ```blocks
let item = 0; let item = 0;
basic.showNumber(item); basic.showNumber(item);
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
item = item + 1; item = item + 1;
basic.showNumber(item); basic.showNumber(item);
}); });
input.onButtonEvent(Button.B, ButtonEvent.Down, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
control.reset(); control.reset();
}); });
``` ```

View File

@ -16,11 +16,11 @@ Press button ``A`` as much as possible to increase the score.
Press ``B`` to display the score and reset the score. Press ``B`` to display the score and reset the score.
```blocks ```blocks
input.onButtonEvent(Button.B, ButtonEvent.Down, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showNumber(game.score()) basic.showNumber(game.score())
game.setScore(0) game.setScore(0)
}) })
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
game.addScore(1) game.addScore(1)
}) })
``` ```

View File

@ -16,7 +16,7 @@ Press button ``A`` as much as possible.
At the end of 10 seconds, the program will show your score. At the end of 10 seconds, the program will show your score.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
game.addScore(1) game.addScore(1)
}) })
game.startCountdown(10000) game.startCountdown(10000)

View File

@ -27,7 +27,7 @@ let img = images.createImage(`
. . . . . . . . . .
`) `)
img.showImage(0) img.showImage(0)
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
img.clear() img.clear()
img.showImage(0) img.showImage(0)
}) })

View File

@ -14,10 +14,10 @@ If you press button `B`, it shows an animation and ends the game.
```blocks ```blocks
basic.showString("PICK A BUTTON"); basic.showString("PICK A BUTTON");
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
basic.showString("YOU WIN!"); basic.showString("YOU WIN!");
}); });
input.onButtonEvent(Button.B, ButtonEvent.Down, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
game.gameOver(); game.gameOver();
}); });
``` ```

View File

@ -20,7 +20,7 @@ degrees -- exactly the opposite direction.
```blocks ```blocks
let ball = game.createSprite(4, 2); let ball = game.createSprite(4, 2);
basic.showNumber(ball.get(LedSpriteProperty.Direction)); basic.showNumber(ball.get(LedSpriteProperty.Direction));
input.onButtonEvent(Button.B, ButtonEvent.Down, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
ball.ifOnEdgeBounce(); ball.ifOnEdgeBounce();
basic.showNumber(ball.get(LedSpriteProperty.Direction)); basic.showNumber(ball.get(LedSpriteProperty.Direction));
}); });

View File

@ -15,7 +15,7 @@ game.isPaused()
Resume the game if it's paused and button **B** is pressed. Resume the game if it's paused and button **B** is pressed.
```blocks ```blocks
input.onButtonEvent(Button.B, ButtonEvent.Down, function () { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), function () {
if (game.isPaused()) { if (game.isPaused()) {
game.resume() game.resume()
} }

View File

@ -13,7 +13,7 @@ This program adds one point to your score every time you press button
second) and shows your score. second) and shows your score.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Down, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
game.addScore(1); game.addScore(1);
basic.pause(500); basic.pause(500);
basic.showNumber(game.score()); basic.showNumber(game.score());

View File

@ -13,7 +13,7 @@ basic.showString("Micro!")
Well, the text stopped scrolling. Place the ``||basic:show string||`` block in the ``||input:on button pressed||`` slot to scroll your name when button **A** is pressed. Well, the text stopped scrolling. Place the ``||basic:show string||`` block in the ``||input:on button pressed||`` slot to scroll your name when button **A** is pressed.
```blocks ```blocks
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("Micro!") basic.showString("Micro!")
}); });
``` ```
@ -25,7 +25,7 @@ Place some blocks to display a smiley when button **B** is pressed.
Use the dropdown to find ``B``! Use the dropdown to find ``B``!
```blocks ```blocks
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showLeds(` basic.showLeds(`
# # . # # # # . # #
# # . # # # # . # #

View File

@ -13,7 +13,7 @@ basic.showString("My Name")
Well, you noticed that the text stopped. Place the ``||basic:show string||`` block in an ``||input:on button pressed||`` block to scroll your name whenever button **A** is pressed. Well, you noticed that the text stopped. Place the ``||basic:show string||`` block in an ``||input:on button pressed||`` block to scroll your name whenever button **A** is pressed.
```block ```block
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("My Name") basic.showString("My Name")
}); });
``` ```
@ -23,7 +23,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
Ok, let's try to talk to the @boardname@ using a button. Change the text in ``||basic:show string||`` to ask the question "How are you?". Add another ``||basic:show string||`` with "....." to show that the @boardname@ is thinking. Ok, let's try to talk to the @boardname@ using a button. Change the text in ``||basic:show string||`` to ask the question "How are you?". Add another ``||basic:show string||`` with "....." to show that the @boardname@ is thinking.
```block ```block
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("How are you?") basic.showString("How are you?")
basic.showString("....."); basic.showString(".....");
}) })
@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
Now, make the @boardname@ give an answer with a smiley face! Find the ``||basic:show leds||`` and draw a smiley face on the block by clicking on the LEDs. Press button **A** in the simulator and see the @boardname@ respond to your question. Now, make the @boardname@ give an answer with a smiley face! Find the ``||basic:show leds||`` and draw a smiley face on the block by clicking on the LEDs. Press button **A** in the simulator and see the @boardname@ respond to your question.
```block ```block
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
basic.showString("How are you?") basic.showString("How are you?")
basic.showString("....."); basic.showString(".....");
basic.showLeds(` basic.showLeds(`

View File

@ -57,7 +57,7 @@ You could simply save the light measurements in an array like this:
```blocks ```blocks
let darkness: number[] = [] let darkness: number[] = []
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
for (let i = 0; i < 60 * 4; i++) { for (let i = 0; i < 60 * 4; i++) {
darkness.push(input.lightLevel()) darkness.push(input.lightLevel())
basic.pause(60000) basic.pause(60000)
@ -77,7 +77,7 @@ The code in blocks for recording the light level is modified to make our file da
```typescript-ignore ```typescript-ignore
let darkness = pins.createBuffer(60 * 4); let darkness = pins.createBuffer(60 * 4);
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
for (let i = 0; i < 60 * 4; i++) { for (let i = 0; i < 60 * 4; i++) {
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel()) darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
basic.pause(60000) basic.pause(60000)
@ -90,7 +90,7 @@ Later, we can upload the file to the laptop computer by pressing the **B** butto
```typescript-ignore ```typescript-ignore
let dataReady = false; let dataReady = false;
let darkness = pins.createBuffer(60 * 4); let darkness = pins.createBuffer(60 * 4);
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
for (let i = 0; i < 60 * 4; i++) { for (let i = 0; i < 60 * 4; i++) {
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel()) darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
basic.pause(60000) basic.pause(60000)
@ -98,7 +98,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
dataReady = true; dataReady = true;
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
if (dataReady) { if (dataReady) {
serial.writeLine("Transferring file: DARKNESS, Length: " + darkness.length + " bytes..."); serial.writeLine("Transferring file: DARKNESS, Length: " + darkness.length + " bytes...");
serial.writeBuffer(darkness) serial.writeBuffer(darkness)

View File

@ -1,9 +1,9 @@
{ {
"name": "{0} block", "name": "{0} block",
"description": "",
"dependencies": { "dependencies": {
"core": "file:../core" "core": "file:../core"
}, },
"description": "",
"files": [ "files": [
"main.blocks", "main.blocks",
"main.ts", "main.ts",

View File

@ -1,6 +1,9 @@
{ {
"name": "bluetooth", "name": "bluetooth",
"description": "Bluetooth services", "description": "Bluetooth services",
"dependencies": {
"core": "file:../core"
},
"files": [ "files": [
"README.md", "README.md",
"enums.d.ts", "enums.d.ts",
@ -10,13 +13,10 @@
"BLEHF2Service.h", "BLEHF2Service.h",
"BLEHF2Service.cpp" "BLEHF2Service.cpp"
], ],
"public": true,
"weight": 10, "weight": 10,
"searchOnly": true, "searchOnly": true,
"icon": "./static/packages/bluetooth/icon.png", "icon": "./static/packages/bluetooth/icon.png",
"public": true,
"dependencies": {
"core": "file:../core"
},
"yotta": { "yotta": {
"config": { "config": {
"microbit-dal": { "microbit-dal": {

View File

@ -1,10 +1,10 @@
{ {
"name": "{0} block", "name": "{0} block",
"description": "",
"dependencies": { "dependencies": {
"core": "file:../core", "core": "file:../core",
"bluetooth": "file:../bluetooth" "bluetooth": "file:../bluetooth"
}, },
"description": "",
"files": [ "files": [
"main.blocks", "main.blocks",
"main.ts", "main.ts",

View File

@ -159,7 +159,7 @@
"Math.icos|param|theta": "Eingangswinkel von 0-255", "Math.icos|param|theta": "Eingangswinkel von 0-255",
"Math.idiv": "Gibt den Wert einer 32-Bit-Ganzzahl (mit Vorzeichen) bei der Division zweier Zahlen aus.", "Math.idiv": "Gibt den Wert einer 32-Bit-Ganzzahl (mit Vorzeichen) bei der Division zweier Zahlen aus.",
"Math.idiv|param|x": "Die erste Zahl", "Math.idiv|param|x": "Die erste Zahl",
"Math.idiv|param|y": "Die zweite Zahl, "Math.idiv|param|y": "Die zweite Zahl",
"Math.imul": "Gibt den Wert einer 32-Bit-Ganzzahl (mit Vorzeichen) bei der Multiplikation zweier Zahlen aus.", "Math.imul": "Gibt den Wert einer 32-Bit-Ganzzahl (mit Vorzeichen) bei der Multiplikation zweier Zahlen aus.",
"Math.imul|param|x": "Die erste Zahl", "Math.imul|param|x": "Die erste Zahl",
"Math.imul|param|y": "Die zweite Zahl", "Math.imul|param|y": "Die zweite Zahl",
@ -220,7 +220,7 @@
"String.indexOf|param|start": "optionaler Startindex für die Suche", "String.indexOf|param|start": "optionaler Startindex für die Suche",
"String.isEmpty": "Gibt einen Wert aus, der anzeigt, ob die Zeichenfolge leer ist", "String.isEmpty": "Gibt einen Wert aus, der anzeigt, ob die Zeichenfolge leer ist",
"String.length": "Gibt die Länge einer Zeichenfolge aus.", "String.length": "Gibt die Länge einer Zeichenfolge aus.",
"String.replace": "Gib die aktuelle Zeichenkette mit dem ersten Auftreten von toReplace zurück,\nmit dem zu ersetzenden Inhalt gefüllt\n\n\oder eine Funktion die eine Teil-Zeichenfolge akzeptiert und den zu ersetzenden Inhalt zurückgibt.", "String.replace": "Gib die aktuelle Zeichenkette mit dem ersten Auftreten von toReplace zurück,\nmit dem zu ersetzenden Inhalt gefüllt \n\n\n oder eine Funktion die eine Teil-Zeichenfolge akzeptiert und den zu ersetzenden Inhalt zurückgibt.",
"String.replaceAll": "Gibt die aktuelle Zeichenkette zurück, bei der jedes Auftreten von toReplace\ndurch den Ersetzer oder einer Funktion ersetzt wird, \n\n\ndie die Zeichenkette akzeptiert und den Ersetzungsstring zurückgibt.", "String.replaceAll": "Gibt die aktuelle Zeichenkette zurück, bei der jedes Auftreten von toReplace\ndurch den Ersetzer oder einer Funktion ersetzt wird, \n\n\ndie die Zeichenkette akzeptiert und den Ersetzungsstring zurückgibt.",
"String.replaceAll|param|replacer": "entweder die Zeichenfolge, die toReplace in der aktuellen Zeichenfolge ersetzt,", "String.replaceAll|param|replacer": "entweder die Zeichenfolge, die toReplace in der aktuellen Zeichenfolge ersetzt,",
"String.replaceAll|param|toReplace": "der Teilstring der in der aktuellen Zeichenkette ersetzt werden soll", "String.replaceAll|param|toReplace": "der Teilstring der in der aktuellen Zeichenkette ersetzt werden soll",
@ -234,23 +234,23 @@
"String.substr": "Gibt eine Teilzeichenfolge der aktuellen Zeichenfolge aus.", "String.substr": "Gibt eine Teilzeichenfolge der aktuellen Zeichenfolge aus.",
"String.substr|param|length": "Anzahl der zu extrahierenden Zeichen", "String.substr|param|length": "Anzahl der zu extrahierenden Zeichen",
"String.substr|param|start": "Erster Zeichenindex, kann beim zählen vom Ende negativ sein, zum Beispiel: 0", "String.substr|param|start": "Erster Zeichenindex, kann beim zählen vom Ende negativ sein, zum Beispiel: 0",
"String.toLowerCase": "Converts the string to lower case characters.", "String.toLowerCase": "Konvertiert die Zeichenfolge in Kleinbuchstaben.",
"String.trim": "Return a substring of the current string with whitespace removed from both ends", "String.trim": "Gibt eine Zeichenkette aus deraktuellen Zeichenkette zurück, welche die Leerzeichen von beiden Enden entfernt hat",
"String@type": "Combine, split, and search text strings.", "String@type": "Kombinieren, trennen und suchen von Text-Zeichenfolgen.",
"StringMap": "A dictionary from string key to string values", "StringMap": "Ein Wörterbuch von String-Schlüsseln zu String-Werten",
"_py.range": "Returns a sequence of numbers up to but not including the limit\n\nIf more than one argument is passed, this argument is instead used for the first value in the range", "_py.range": "Gibt eine Folge von Zahlen bis zum aber ohne das Limits zurück\n\nWenn mehr als ein Argument übergeben wird, wird dieses Argument stattdessen für den ersten Wert im Bereich verwendet",
"_py.range|param|first": "The value to end the sequence before. This value will not show up in the result.", "_py.range|param|first": "Der Wert, der die vorherige Sequenz abschließt. Dieser Wert wird nicht im Ergebnis angezeigt.",
"_py.range|param|step": "The value to increase or decrease by for each step in the range. Must be a nonzero integer", "_py.range|param|step": "Der Wert, der für jeden Schritt im Bereich erhöht oder verringert werden soll. Muss eine ganze Zahl ohne Null sein",
"_py.range|param|stop": "The value to end the sequence before. This value will not show up in the result", "_py.range|param|stop": "Der Wert, der die vorherige Sequenz abschließt. Dieser Wert wird nicht im Ergebnis angezeigt",
"_py.slice": "Returns a section of an array according to python's extended slice syntax", "_py.slice": "Gibt einen Abschnitt eines Arrays gemäß Pythons erweiterter Slice Syntax zurück",
"_py.stringSlice": "Returns a section of a string according to python's extended slice syntax", "_py.stringSlice": "Gibt einen Abschnitt einer Zeichenkette gemäß Pythons erweiterter Slice Syntax zurück",
"basic": "Bietet Zugriff auf grundlegende mini-Funktionalität.", "basic": "Bietet Zugriff auf grundlegende mini-Funktionalität.",
"basic.clearScreen": "Schalte alle LEDs aus", "basic.clearScreen": "Schalte alle LEDs aus",
"basic.color": "Konvertiert den Farbnamen in eine Nummer", "basic.color": "Konvertiert den Farbnamen in eine Nummer",
"basic.forever": "Wiederholt immer wieder den Code im Hintergrund. Bei jeder Iteration ist es möglich, anderen Code auszuführen.", "basic.forever": "Wiederholt immer wieder den Code im Hintergrund. Bei jeder Iteration ist es möglich, anderen Code auszuführen.",
"basic.pause": "Pausiere für die angegebene Zeit in Millisekunden", "basic.pause": "Pausiere für die angegebene Zeit in Millisekunden",
"basic.pause|param|ms": "wie lange pausieren, z.B.: 100, 200, 500, 1000, 2000", "basic.pause|param|ms": "wie lange pausieren, z.B.: 100, 200, 500, 1000, 2000",
"basic.plotLeds": "Zeichnet ein Bild auf dem LED-Bildschirm.", "basic.plotLeds": "Zeichnet ein Bild auf der LED-Matrix.",
"basic.plotLeds|param|leds": "Muster der LEDs, die ein-/ und ausgeschaltet werden", "basic.plotLeds|param|leds": "Muster der LEDs, die ein-/ und ausgeschaltet werden",
"basic.rgb": "Konvertiert Rot-, Grün- und Blau-Kanäle in eine RGB-Farbe", "basic.rgb": "Konvertiert Rot-, Grün- und Blau-Kanäle in eine RGB-Farbe",
"basic.rgb|param|blue": "Blauwert zwischen 0 und 255, z.B. 255", "basic.rgb|param|blue": "Blauwert zwischen 0 und 255, z.B. 255",
@ -260,27 +260,27 @@
"basic.showAnimation": "Zeigt eine Abfolge von LED-Anzeigen als Animation.", "basic.showAnimation": "Zeigt eine Abfolge von LED-Anzeigen als Animation.",
"basic.showAnimation|param|interval": "Zeit in Millisekunden zwischen jedem Neuzeichnen", "basic.showAnimation|param|interval": "Zeit in Millisekunden zwischen jedem Neuzeichnen",
"basic.showAnimation|param|leds": "Muster der LEDs, die ein-/ und ausgeschaltet werden", "basic.showAnimation|param|leds": "Muster der LEDs, die ein-/ und ausgeschaltet werden",
"basic.showArrow": "Draws an arrow on the LED screen", "basic.showArrow": "Zeigt einen Pfeil auf der LED-Matrix an",
"basic.showArrow|param|direction": "the direction of the arrow", "basic.showArrow|param|direction": "die Richtung des Pfeils",
"basic.showArrow|param|interval": "the amount of time (milliseconds) to show the icon. Default is 600.", "basic.showArrow|param|interval": "die Zeitspanne (in Millisekunden), in der das Symbol angezeigt wird. Die Standardeinstellung ist 600.",
"basic.showCompass": "Draws needle on the screen which always points to north", "basic.showCompass": "Zeichnet eine Nadel, die immer nach Norden zeigt",
"basic.showCompass|param|interval": "the amount of time (milliseconds) to show the needle. Default is 600.", "basic.showCompass|param|interval": "die Zeitspanne (in Millisekunden), in der die Nadel angezeigt wird. Die Standardeinstellung ist 600.",
"basic.showIcon": "Draws the selected icon on the LED screen", "basic.showIcon": "Zeichnet das ausgewählte Symbol auf der LED-Matrix",
"basic.showIcon|param|icon": "the predefined icon id", "basic.showIcon|param|icon": "die vordefinierte Matrix-ID",
"basic.showIcon|param|interval": "the amount of time (milliseconds) to block the LED Matrix for showing the icon. Default is 600.", "basic.showIcon|param|interval": "die Zeitspanne (in Millisekunden), in der die LED-Matrix angezeigt wird. Die Standardeinstellung ist 600.",
"basic.showLeds": "Zeichnet ein Bild auf dem LED-Bildschirm.", "basic.showLeds": "Zeichnet ein Bild auf der LED-Matrix.",
"basic.showLeds|param|interval": "Zeit in Millisekunden, die nach der Zeichnung gewartet wird", "basic.showLeds|param|interval": "Zeit in Millisekunden, die nach der Zeichnung gewartet wird",
"basic.showLeds|param|leds": "Muster der LEDs, die ein- und ausgeschaltet werden", "basic.showLeds|param|leds": "Muster der LEDs, die ein- und ausgeschaltet werden",
"basic.showNumber": "Zeige eine Nummer auf dem Display. Wenn die Nummer auf das Display passt (es sich also um eine einstellige Zahl handelt), scrolle nicht weiter.", "basic.showNumber": "Zeige eine Nummer auf dem Display. Wenn die Nummer auf das Display passt (es sich also um eine einstellige Zahl handelt), scrolle nicht weiter.",
"basic.showNumber|param|interval": "Scroll-Geschwindigkeit; z.B. 150, 100, 200,-100", "basic.showNumber|param|interval": "Scroll-Geschwindigkeit; z.B. 150, 100, 200,-100",
"basic.showString": "Zeige Text auf dem Display an, Buchstabe für Buchstabe. Wenn die Zeichenfolge in das Display passt (also wenn es sich um einen einzelnen Buchstaben handelt), scrolle nicht weiter.", "basic.showString": "Zeige Text auf der LED-Matrix an, Buchstabe für Buchstabe. Wenn die Zeichenfolge auf die LED-Matrix passt (also wenn es sich um einen einzelnen Buchstaben handelt), scrolle nicht weiter.",
"basic.showString|param|interval": "Wie schnell die Zeichen geändert werden; z.B. 150, 100, 200,-100", "basic.showString|param|interval": "Wie schnell die Zeichen geändert werden; z.B. 150, 100, 200,-100",
"basic.showString|param|text": "Text auf dem Bildschirm dargestellt werden soll, z.B.: \"Hi!\"", "basic.showString|param|text": "Text auf LED-Matrix dargestellt werden soll, z.B.: \"Hi!\"",
"basic.turnRgbLedOff": "Sets the color on the build-in LED. Set to 0 to turn off.", "basic.turnRgbLedOff": "Legt die Farbe der eingebauten RGB-LED fest. Setze auf 0, um diese abzuschalten.",
"console": "Reading and writing data to the console output.", "console": "Lesen und Schreiben von Daten in die Konsolenausgabe.",
"console.addListener": "Adds a listener for the log messages", "console.addListener": "Fügt einen Listener für die Log-Nachrichten hinzu",
"console.inspect": "Convert any object or value to a string representation", "console.inspect": "Konvertiert ein beliebigen Objekts oder Wert in einen String",
"console.inspect|param|maxElements": "[optional] max number values in an object to include in output", "console.inspect|param|maxElements": "[optional] max. Zahlenwerte in einem Objekt, das in die Ausgabe eingeschlossen werden soll",
"console.inspect|param|obj": "value to be converted to a string", "console.inspect|param|obj": "value to be converted to a string",
"console.log": "Write a line of text to the console output.", "console.log": "Write a line of text to the console output.",
"console.logValue": "Write a name:value pair as a line of text to the console output.", "console.logValue": "Write a name:value pair as a line of text to the console output.",
@ -335,37 +335,37 @@
"convertToText|param|value": "value to be converted to text", "convertToText|param|value": "value to be converted to text",
"forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.", "forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
"game": "Eine Einzel-LED-Sprite-Spielumgebung", "game": "Eine Einzel-LED-Sprite-Spielumgebung",
"game.LedSprite": "A game sprite rendered as a single LED", "game.LedSprite": "Ein Spiel-Sprite, der als einzelne LED gerendert wird",
"game.LedSprite.blink": "Reports the ``blink`` duration of a sprite", "game.LedSprite.blink": "Meldet die ``Blink``-Dauer eines Sprites",
"game.LedSprite.brightness": "Reports the ``brightness` of a sprite on the LED screen", "game.LedSprite.brightness": "Meldet die ``Helligkeit`` eines Sprites auf dem LED-Bildschirm",
"game.LedSprite.change": "Changes a property of the sprite", "game.LedSprite.change": "Ändert eine Eigenschaft des Sprites",
"game.LedSprite.changeBlinkBy": "Changes the ``blink`` duration by the given amount of millisecons", "game.LedSprite.changeBlinkBy": "Ändert die ``Blink``-Dauer um die angegebene Anzahl an Millisekunden",
"game.LedSprite.changeBlinkBy|param|ms": "TODO", "game.LedSprite.changeBlinkBy|param|ms": "TODO",
"game.LedSprite.changeBrightnessBy": "Changes the ``y`` position by the given amount", "game.LedSprite.changeBrightnessBy": "Ändert die ``Y``-Position um die angegebene Anzahl",
"game.LedSprite.changeBrightnessBy|param|value": "the value to change brightness", "game.LedSprite.changeBrightnessBy|param|value": "der Wert zum Ändern der Helligkeit",
"game.LedSprite.changeDirectionBy": "Changes the ``direction`` position by the given amount by turning right", "game.LedSprite.changeDirectionBy": "Ändert die Position der ``Richtung`` um die angegebene Anzahl durch Drehen nach rechts",
"game.LedSprite.changeDirectionBy|param|angle": "TODO", "game.LedSprite.changeDirectionBy|param|angle": "TODO",
"game.LedSprite.changeXBy": "Changes the ``x`` position by the given amount", "game.LedSprite.changeXBy": "Ändert die ``X``-Position um die angegebene Anzahl",
"game.LedSprite.changeXBy|param|x": "TODO", "game.LedSprite.changeXBy|param|x": "TODO",
"game.LedSprite.changeYBy": "Changes the ``y`` position by the given amount", "game.LedSprite.changeYBy": "Ändert die ``Y``-Position um die angegebene Anzahl",
"game.LedSprite.changeYBy|param|y": "TODO", "game.LedSprite.changeYBy|param|y": "TODO",
"game.LedSprite.change|param|property": "the name of the property to change", "game.LedSprite.change|param|property": "der Name der Eigenschaft zum Ändern",
"game.LedSprite.change|param|value": "amount of change, eg: 1", "game.LedSprite.change|param|value": "Anzahl der Veränderung, z. B.: 1",
"game.LedSprite.delete": "Deletes the sprite from the game engine. The sprite will no longer appear on the screen or interact with other sprites.", "game.LedSprite.delete": "Löscht den Sprite aus der Spielumgebung. Der Sprite erscheint nicht mehr auf dem Bildschirm und interagiert nicht mehr mit anderen Sprites.",
"game.LedSprite.direction": "Reports the current direction of a sprite", "game.LedSprite.direction": "Meldet die aktuelle Richtung eines Sprites",
"game.LedSprite.get": "Gets a property of the sprite", "game.LedSprite.get": "Ruft eine Eigenschaft des Sprites ab",
"game.LedSprite.get|param|property": "the name of the property to change", "game.LedSprite.get|param|property": "der Name der Eigenschaft zum Ändern",
"game.LedSprite.goTo": "Go to this position on the screen", "game.LedSprite.goTo": "Gehe zu dieser Position auf dem Bildschirm",
"game.LedSprite.goTo|param|x": "TODO", "game.LedSprite.goTo|param|x": "TODO",
"game.LedSprite.goTo|param|y": "TODO", "game.LedSprite.goTo|param|y": "TODO",
"game.LedSprite.ifOnEdgeBounce": "If touching the edge of the stage and facing towards it, then turn away.", "game.LedSprite.ifOnEdgeBounce": "Wenn der Bildschirmrand berührt wird und die Sichtrichtung geradeaus ist, wegdrehen.",
"game.LedSprite.isDeleted": "Reports whether the sprite has been deleted from the game engine.", "game.LedSprite.isDeleted": "Meldet, ob der Sprite aus der Spiele-Engine gelöscht wurde.",
"game.LedSprite.isTouching": "Reports true if sprite has the same position as specified sprite", "game.LedSprite.isTouching": "Meldet wahr, wenn der Sprite dieselbe Position hat wie der angegebene Sprite",
"game.LedSprite.isTouchingEdge": "Reports true if sprite is touching an edge", "game.LedSprite.isTouchingEdge": "Meldet wahr, wenn der Sprite einen Rand berührt",
"game.LedSprite.isTouching|param|other": "the other sprite to check overlap or touch", "game.LedSprite.isTouching|param|other": "der andere Sprite, um Überlagerung oder Berührung zu überprüfen",
"game.LedSprite.move": "Move a certain number of LEDs in the current direction", "game.LedSprite.move": "Bewege eine bestimmte Anzahl von LEDs in die aktuelle Richtung",
"game.LedSprite.move|param|leds": "number of leds to move, eg: 1, -1", "game.LedSprite.move|param|leds": "Anzahl der zu bewegenden LEDs, z. B.: 1, -1",
"game.LedSprite.off": "Turns off the sprite (on by default)", "game.LedSprite.off": "Schaltet den Sprite aus (bei Standardeinstellung ein)",
"game.LedSprite.on": "Turns on the sprite (on by default)", "game.LedSprite.on": "Turns on the sprite (on by default)",
"game.LedSprite.set": "Sets a property of the sprite", "game.LedSprite.set": "Sets a property of the sprite",
"game.LedSprite.setBlink": "Sets the blink duration interval in millisecond.", "game.LedSprite.setBlink": "Sets the blink duration interval in millisecond.",

12
libs/core/enums.d.ts vendored
View File

@ -39,21 +39,11 @@ declare namespace basic {
} }
declare const enum ButtonEvent { declare const enum ButtonEvents {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
Down = 1, // MICROBIT_BUTTON_EVT_DOWN Down = 1, // MICROBIT_BUTTON_EVT_DOWN
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = 2, // MICROBIT_BUTTON_EVT_UP Up = 2, // MICROBIT_BUTTON_EVT_UP
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = 3, // MICROBIT_BUTTON_EVT_CLICK Click = 3, // MICROBIT_BUTTON_EVT_CLICK
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = 4, // MICROBIT_BUTTON_EVT_LONG_CLICK LongClick = 4, // MICROBIT_BUTTON_EVT_LONG_CLICK
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = 5, // MICROBIT_BUTTON_EVT_HOLD Hold = 5, // MICROBIT_BUTTON_EVT_HOLD
} }

View File

@ -323,9 +323,9 @@ namespace game {
} }
function unplugEvents(): void { function unplugEvents(): void {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { }); input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => { });
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { }); input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => { });
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => { input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
control.reset(); control.reset();
}); });
} }

View File

@ -7,21 +7,11 @@ enum class Button {
AB = MICROBIT_ID_BUTTON_AB, AB = MICROBIT_ID_BUTTON_AB,
}; };
enum class ButtonEvent { enum class ButtonEvents {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
Down = MICROBIT_BUTTON_EVT_DOWN, Down = MICROBIT_BUTTON_EVT_DOWN,
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = MICROBIT_BUTTON_EVT_UP, Up = MICROBIT_BUTTON_EVT_UP,
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = MICROBIT_BUTTON_EVT_CLICK, Click = MICROBIT_BUTTON_EVT_CLICK,
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = MICROBIT_BUTTON_EVT_LONG_CLICK, LongClick = MICROBIT_BUTTON_EVT_LONG_CLICK,
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = MICROBIT_BUTTON_EVT_HOLD, Hold = MICROBIT_BUTTON_EVT_HOLD,
}; };

View File

@ -1,3 +1,23 @@
enum ButtonEvent {
//% blockIdentity="input.buttonEventValueId"
//% block="pressed down"
Down = ButtonEvents.Down,
//% blockIdentity="input.buttonEventValueId"
//% block="released up"
Up = ButtonEvents.Up,
//% blockIdentity="input.buttonEventValueId"
//% block="clicked"
Click = ButtonEvents.Click,
//% blockIdentity="input.buttonEventValueId"
//% block="long clicked"
LongClick = ButtonEvents.LongClick,
//% blockIdentity="input.buttonEventValueId"
//% block="hold"
Hold = ButtonEvents.Hold,
};
/** /**
* Events and data from sensors * Events and data from sensors
*/ */
@ -10,7 +30,7 @@ namespace input {
*/ */
//% help=input/button-event //% help=input/button-event
//% weight=19 blockId="control_button_event_value" block="%id" //% weight=19 blockId="control_button_event_value" block="%id"
//% shim=TD_ID advanced=true //% advanced=true
//% group="Events" //% group="Events"
export function buttonEventValue(id: ButtonEvent): number { export function buttonEventValue(id: ButtonEvent): number {
return id; return id;

View File

@ -1,7 +1,7 @@
{ {
"name": "core", "name": "core",
"description": "The microbit core library", "description": "The microbit core library",
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base", "dependencies": {},
"files": [ "files": [
"README.md", "README.md",
"platform.h", "platform.h",
@ -76,7 +76,7 @@
], ],
"testFiles": [], "testFiles": [],
"public": true, "public": true,
"dependencies": {}, "additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
"dalDTS": { "dalDTS": {
"compileServiceVariant": "mbcodal", "compileServiceVariant": "mbcodal",
"includeDirs": [ "includeDirs": [
@ -172,5 +172,6 @@
} }
} }
] ]
} },
"partial": true
} }

View File

@ -1,6 +1,10 @@
{ {
"name": "devices", "name": "devices",
"description": "BETA - Camera, remote control and other Bluetooth services. App required.", "description": "BETA - Camera, remote control and other Bluetooth services. App required.",
"dependencies": {
"core": "file:../core",
"bluetooth": "file:../bluetooth"
},
"files": [ "files": [
"README.md", "README.md",
"enums.d.ts", "enums.d.ts",
@ -8,12 +12,8 @@
"devices.cpp", "devices.cpp",
"devices.ts" "devices.ts"
], ],
"public": true,
"icon": "./static/packages/devices/icon.png", "icon": "./static/packages/devices/icon.png",
"hidden": true, "hidden": true,
"public": true,
"dependencies": {
"core": "file:../core",
"bluetooth": "file:../bluetooth"
},
"installedVersion": "ljipgq" "installedVersion": "ljipgq"
} }

View File

@ -1,5 +1,9 @@
{ {
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone", "name": "microphone",
"description": "The microphone library",
"dependencies": {
"core": "file:../core"
},
"files": [ "files": [
"README.md", "README.md",
"microphone.cpp", "microphone.cpp",
@ -7,8 +11,10 @@
"enums.d.ts", "enums.d.ts",
"shims.d.ts" "shims.d.ts"
], ],
"hidden": true, "testFiles": [
"dependencies": { "test.ts"
"core": "file:../core" ],
} "public": true,
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
"hidden": true
} }

View File

@ -22,10 +22,10 @@ enum RadioMessage {
heart, heart,
skull skull
} }
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.heart) radio.sendMessage(RadioMessage.heart)
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, function () { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.skull) radio.sendMessage(RadioMessage.skull)
}) })
radio.onReceivedMessage(RadioMessage.heart, function () { radio.onReceivedMessage(RadioMessage.heart, function () {

View File

@ -20,10 +20,10 @@ enum RadioMessage {
heart, heart,
skull skull
} }
input.onButtonEvent(Button.A, ButtonEvent.Click, function () { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.heart) radio.sendMessage(RadioMessage.heart)
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, function () { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
radio.sendMessage(RadioMessage.skull) radio.sendMessage(RadioMessage.skull)
}) })
radio.onReceivedMessage(RadioMessage.heart, function () { radio.onReceivedMessage(RadioMessage.heart, function () {

View File

@ -1,4 +1,13 @@
{ {
"name": "radio-broadcast",
"description": "Adds new blocks for message communication in the radio category",
"dependencies": {
"core": "file:../core",
"radio": "file:../radio"
},
"files": [
"radio-broadcast.ts"
],
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio-broadcast", "additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio-broadcast",
"icon": "./static/packages/radio-broadcast/icon.png" "icon": "./static/packages/radio-broadcast/icon.png"
} }

View File

@ -1,4 +1,18 @@
{ {
"name": "radio",
"description": "The radio services",
"dependencies": {
"core": "file:../core"
},
"files": [
"README.md",
"shims.d.ts",
"enums.d.ts",
"radio.cpp",
"radio.ts",
"targetoverrides.ts"
],
"public": true,
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio", "additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio",
"icon": "./static/packages/radio/icon.png", "icon": "./static/packages/radio/icon.png",
"yotta": { "yotta": {

View File

@ -1,14 +1,16 @@
{ {
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo", "name": "servo",
"description": "A micro-servo library",
"dependencies": {
"core": "file:../core"
},
"files": [ "files": [
"README.md", "README.md",
"servo.ts", "servo.ts",
"ns.ts", "ns.ts",
"targetoverrides.ts" "targetoverrides.ts"
], ],
"icon": "./static/packages/servo/icon.png",
"public": true, "public": true,
"dependencies": { "additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo",
"core": "file:../core" "icon": "./static/packages/servo/icon.png"
}
} }

View File

@ -1,10 +1,10 @@
{ {
"name": "{0} bit", "name": "{0} bit",
"description": "",
"dependencies": { "dependencies": {
"core": "file:../core", "core": "file:../core",
"radio": "file:../radio" "radio": "file:../radio"
}, },
"description": "",
"files": [ "files": [
"main.ts", "main.ts",
"README.md" "README.md"

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "pxt-calliopemini", "name": "pxt-calliopemini",
"version": "4.0.28", "version": "4.0.30",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "pxt-calliopemini", "name": "pxt-calliopemini",
"version": "4.0.28", "version": "4.0.30",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"pxt-common-packages": "9.0.1", "pxt-common-packages": "9.0.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "pxt-calliopemini", "name": "pxt-calliopemini",
"version": "4.0.28", "version": "4.0.30",
"description": "calliope mini target for Microsoft MakeCode (PXT)", "description": "calliope mini target for Microsoft MakeCode (PXT)",
"keywords": [ "keywords": [
"JavaScript", "JavaScript",
@ -46,6 +46,6 @@
}, },
"dependencies": { "dependencies": {
"pxt-common-packages": "9.0.1", "pxt-common-packages": "9.0.1",
"pxt-core": "7.0.17" "pxt-core": "7.0.22"
} }
} }

View File

@ -105,13 +105,21 @@
"basic\\s*\\.\\s*showArrow\\s*\\(": "basic.showIcon(", "basic\\s*\\.\\s*showArrow\\s*\\(": "basic.showIcon(",
"images\\s*\\.\\s*arrowImage\\s*\\(": "images.iconImage(", "images\\s*\\.\\s*arrowImage\\s*\\(": "images.iconImage(",
"ArrowNames\\s*\\.\\s*": "IconNames.Arrow", "ArrowNames\\s*\\.\\s*": "IconNames.Arrow",
"input\\s*\\.\\s*onButtonPressed\\s*\\(\\s*(.*?),": "input.onButtonEvent($1, ButtonEvent.Click,", "input\\s*\\.\\s*onButtonPressed\\s*\\(\\s*(.*?),": "input.onButtonEvent($1, input.buttonEventValue(ButtonEvent.Click),",
"input\\s*\\.\\s*onPinPressed\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, ButtonEvent.Down,", "input\\s*\\.\\s*onPinPressed\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, input.buttonEventValue(ButtonEvent.Down),",
"input\\s*\\.\\s*onPinReleased\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, ButtonEvent.Up,", "input\\s*\\.\\s*onPinReleased\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, input.buttonEventValue(ButtonEvent.Up),",
"input\\s*\\.\\s*loudness\\s*\\(": "input.soundLevel(", "input\\s*\\.\\s*loudness\\s*\\(": "input.soundLevel(",
"basic\\s*\\.\\s*rgbw\\s*\\(\\s*(.*?),\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*\\)": "basic.rgb($1, $2, $3)" "basic\\s*\\.\\s*rgbw\\s*\\(\\s*(.*?),\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*\\)": "basic.rgb($1, $2, $3)"
} }
} }
],
"0.0.0 - 4.0.29": [
{
"type": "api",
"map": {
"input\\s*\\.\\s*onButtonEvent\\s*\\(\\s*(.*?),\\s*ButtonEvent\\s*.\\s*(.*?),": "input.onButtonEvent($1, input.buttonEventValue(ButtonEvent.$2),"
}
}
] ]
}, },
"hidSelectors": [{ "hidSelectors": [{

View File

@ -18,40 +18,47 @@
"KitronikLtd/pxt-kitronik-rtc", "KitronikLtd/pxt-kitronik-rtc",
"KitronikLtd/pxt-kitronik-servo-lite", "KitronikLtd/pxt-kitronik-servo-lite",
"KitronikLtd/pxt-kitronik-stopbit", "KitronikLtd/pxt-kitronik-stopbit",
"MKleinSB/pxt-MAX7219_8x8",
"MKleinSB/pxt-OLED-SSD1306",
"MKleinSB/pxt-OLEDpaint",
"MKleinSB/pxt-callibot",
"MKleinSB/pxt-callicolor",
"MKleinSB/pxt-callicross",
"MKleinSB/pxt-callimotor",
"MKleinSB/pxt-calliope-buttons",
"MKleinSB/pxt-CO2OLED",
"MKleinSB/pxt-dht11",
"MKleinSB/pxt-esp-thingspeak",
"MKleinSB/pxt-gatorlog-calliope",
"MKleinSB/pxt-huskylens",
"MKleinSB/pxt-kitronik-zip-tile-calliope",
"MKleinSB/pxt-mpr121",
"MKleinSB/pxt-pca9685",
"MKleinSB/pxt-seeed-temperature",
"MKleinSB/pxt-serialmp3",
"MKleinSB/pxt-KY-040",
"MKleinSB/ScrollText", "MKleinSB/ScrollText",
"MKleinSB/pxt-BME680", "MKleinSB/pxt-BME680",
"MKleinSB/pxt-IR-Calliope", "MKleinSB/pxt-IR-Calliope",
"MKleinSB/pxt-MCP23017", "MKleinSB/pxt-MCP23017",
"MKleinSB/pxt-OLED-SSD1306",
"MKleinSB/pxt-Seeed-Temperatursensor", "MKleinSB/pxt-Seeed-Temperatursensor",
"MKleinSB/pxt-automationbit-calliope", "MKleinSB/pxt-automationbit-calliope",
"MKleinSB/pxt-bc95", "MKleinSB/pxt-bc95",
"MKleinSB/pxt-callibot",
"MKleinSB/pxt-callicolor",
"MKleinSB/pxt-callicross",
"MKleinSB/pxt-calliope-esp", "MKleinSB/pxt-calliope-esp",
"MKleinSB/pxt-calliope-oled96", "MKleinSB/pxt-calliope-oled96",
"MKleinSB/pxt-columbuseye", "MKleinSB/pxt-columbuseye",
"MKleinSB/pxt-dht11",
"MKleinSB/pxt-envirobit", "MKleinSB/pxt-envirobit",
"MKleinSB/pxt-esp-thingspeak",
"MKleinSB/pxt-fischertechnik-calliope", "MKleinSB/pxt-fischertechnik-calliope",
"MKleinSB/pxt-foldio", "MKleinSB/pxt-foldio",
"MKleinSB/pxt-ft-fototransistor-calliope", "MKleinSB/pxt-ft-fototransistor-calliope",
"MKleinSB/pxt-gatorlog-calliope",
"MKleinSB/pxt-graphs", "MKleinSB/pxt-graphs",
"MKleinSB/pxt-iot-environment-kit", "MKleinSB/pxt-iot-environment-kit",
"MKleinSB/pxt-kitronik-robotics-board-calliope", "MKleinSB/pxt-kitronik-robotics-board-calliope",
"MKleinSB/pxt-kitronik-zip-64", "MKleinSB/pxt-kitronik-zip-64",
"MKleinSB/pxt-kitronik-zip-tile-calliope",
"MKleinSB/pxt-makerbit-motor-calliope", "MKleinSB/pxt-makerbit-motor-calliope",
"MKleinSB/pxt-makerbit-touch", "MKleinSB/pxt-makerbit-touch",
"MKleinSB/pxt-makerbit-ultrasonic-calliope", "MKleinSB/pxt-makerbit-ultrasonic-calliope",
"MKleinSB/pxt-mpr121",
"MKleinSB/pxt-pca9685",
"MKleinSB/pxt-seeed-temperature",
"MKleinSB/pxt-serial-rb", "MKleinSB/pxt-serial-rb",
"MKleinSB/pxt-serialmp3",
"MKleinSB/pxt-thumbjoystick-calliope", "MKleinSB/pxt-thumbjoystick-calliope",
"Microsoft/pxt-bluetooth-max6675", "Microsoft/pxt-bluetooth-max6675",
"Microsoft/pxt-bluetooth-midi", "Microsoft/pxt-bluetooth-midi",
@ -79,10 +86,16 @@
"alankrantas/pxt-ESP8266_ThingSpeak", "alankrantas/pxt-ESP8266_ThingSpeak",
"assirati/pxt-inventura", "assirati/pxt-inventura",
"calliope-edu/CO2-Sensor-SCD40", "calliope-edu/CO2-Sensor-SCD40",
"calliope-edu/pxt-HM3301_Dust_Sensor",
"calliope-edu/pxt-SCD30", "calliope-edu/pxt-SCD30",
"calliope-edu/pxt-TCS34725FN", "calliope-edu/pxt-TCS34725FN",
"calliope-edu/pxt-display",
"calliope-edu/pxt-grove", "calliope-edu/pxt-grove",
"calliope-edu/pxt-rgblcd",
"calliope-edu/pxt-sunlightsensor-si1145", "calliope-edu/pxt-sunlightsensor-si1145",
"calliope-mini/pxt-SCD30",
"tinysuperlab/motionkit",
"tinysuperlab/touchkit",
"cgs-matthew-pham/pxt-hitechnic-irseeker-v2", "cgs-matthew-pham/pxt-hitechnic-irseeker-v2",
"jcubuntu/pxt-iKB1", "jcubuntu/pxt-iKB1",
"jdarling/pxt-pca9685", "jdarling/pxt-pca9685",
@ -122,7 +135,8 @@
"sparkfun/pxt-gator-temp", "sparkfun/pxt-gator-temp",
"tinysuperlab/motionkit", "tinysuperlab/motionkit",
"tinysuperlab/touchkit", "tinysuperlab/touchkit",
"vengit/pxt-sbrick" "vengit/pxt-sbrick",
"CalliTGS3/pxt-calliope-grovePCF85063TP"
], ],
"preferredRepos": [ "preferredRepos": [
"calliope-edu/CO2-Sensor-SCD40", "calliope-edu/CO2-Sensor-SCD40",
@ -156,8 +170,7 @@
"MKleinSB/pxt-serialmp3", "MKleinSB/pxt-serialmp3",
"Microsoft/pxt-microturtle", "Microsoft/pxt-microturtle",
"Microsoft/pxt-neopixel", "Microsoft/pxt-neopixel",
"dl1ekm/pxt-calliope-ADS1x15", "CalliTGS3/pxt-calliope-grovePCF85063TP"
"dl1ekm/pxt-calliope-PCF85063-RTC"
] ]
}, },
"galleries": { "galleries": {

View File

@ -7,7 +7,7 @@ let level: number
let swapSpeed: number let swapSpeed: number
initializeGame() initializeGame()
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
if (ballRevealing) { if (ballRevealing) {
index = index + 1 index = index + 1
if (index > 2) { if (index > 2) {
@ -16,7 +16,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showString(cupSelect[index], 150) basic.showString(cupSelect[index], 150)
} }
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
if (ballRevealing) { if (ballRevealing) {
ballRevealing = false ballRevealing = false
if (correctBall == index) { if (correctBall == index) {

View File

@ -18,7 +18,7 @@ counter = 0
pause = 700 pause = 700
led.plot(oneX, oneY) led.plot(oneX, oneY)
led.plot(twoX, twoY) led.plot(twoX, twoY)
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
if (oneX > 0) { if (oneX > 0) {
led.unplot(oneX, oneY) led.unplot(oneX, oneY)
led.unplot(twoX, twoY) led.unplot(twoX, twoY)
@ -28,7 +28,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
led.plot(twoX, twoY) led.plot(twoX, twoY)
} }
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
if (twoX < 4) { if (twoX < 4) {
led.unplot(oneX, oneY) led.unplot(oneX, oneY)
led.unplot(twoX, twoY) led.unplot(twoX, twoY)

View File

@ -107,12 +107,12 @@ basic.forever(() => {
basic.pause(500) basic.pause(500)
} }
}) })
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
let temp = Math.abs(person.dirX) * (-1) let temp = Math.abs(person.dirX) * (-1)
person.dirX = Math.abs(person.dirY) * (-1) person.dirX = Math.abs(person.dirY) * (-1)
person.dirY = temp person.dirY = temp
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
let temp1 = Math.abs(person.dirX) let temp1 = Math.abs(person.dirX)
person.dirX = Math.abs(person.dirY) person.dirX = Math.abs(person.dirY)
person.dirY = temp1 person.dirY = temp1

View File

@ -24,13 +24,13 @@ playOneGame(gameTime)
showFinalScores(scoreA, scoreB) showFinalScores(scoreA, scoreB)
function startIOMonitor() { function startIOMonitor() {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
AWasPressed = true AWasPressed = true
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
BWasPressed = true BWasPressed = true
}) })
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => { input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
ABWasPressed = true ABWasPressed = true
AWasPressed = false AWasPressed = false
BWasPressed = false BWasPressed = false

View File

@ -501,13 +501,13 @@ function convertPenaltyTimeToScore(penaltyTime: number): number {
} }
function startIOMonitor() { function startIOMonitor() {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
AWasPressed = true AWasPressed = true
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
BWasPressed = true BWasPressed = true
}) })
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => { input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
ABWasPressed = true ABWasPressed = true
}) })
input.onShake(() => { input.onShake(() => {

View File

@ -377,11 +377,11 @@ function beepNTimesFor(times: number, duration: number) {
function startIOMonitor() { function startIOMonitor() {
aWasPressed = false aWasPressed = false
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
aWasPressed = true aWasPressed = true
}) })
bWasPressed = false bWasPressed = false
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
bWasPressed = true bWasPressed = true
}) })
wasTweezers = false wasTweezers = false

View File

@ -476,10 +476,10 @@ function testTiltZ() {
} }
function startIOMonitor() { function startIOMonitor() {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
AWasPressed = true AWasPressed = true
}) })
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
BWasPressed = true BWasPressed = true
}) })
input.onShake(() => { input.onShake(() => {

View File

@ -82,6 +82,12 @@
} }
} }
} }
// Safari Only for iPad and iPhone second rule
@supports (-webkit-touch-callout: none) {
#mainmenu .right.menu {
margin-right: 4rem;
}
}
/* Mobile */ /* Mobile */
@media only screen and (max-width: @largestMobileScreen) { @media only screen and (max-width: @largestMobileScreen) {