Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
05ea56a249
Bump json-schema from 0.2.3 to 0.4.0
Bumps [json-schema](https://github.com/kriszyp/json-schema) from 0.2.3 to 0.4.0.
- [Release notes](https://github.com/kriszyp/json-schema/releases)
- [Commits](https://github.com/kriszyp/json-schema/compare/v0.2.3...v0.4.0)

---
updated-dependencies:
- dependency-name: json-schema
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-09-12 16:29:56 +00:00
69 changed files with 250 additions and 309 deletions

View File

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

View File

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

View File

@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
node-version: [18.x]
node-version: [8.x]
steps:
- 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):
```block
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
basic.showString("Hi!");
})
```
```typescript
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
basic.showString("Hi!");
})
```
@ -54,7 +54,7 @@ The simulator has support for the LED screen, buttons, as well as compass, accel
basic.forever(() => {
basic.showString("Hi!");
})
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
led.stopAnimation();
basic.showLeds(`
. . . . .
@ -63,7 +63,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
# . . . #
. # # # .`);
});
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
led.stopAnimation();
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:
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
let x = randint(0, 5)
if(x < 5) {
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:
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
if(input.lightLevel()<100){
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
for(let i = 0; i < 5; ++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`).
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
let index = 4;
while(index >= 0) {
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
basic.showString("Hello!")
})
led.setBrightness(50)

View File

@ -59,7 +59,7 @@ A counter is a great example:
```blocks
let counter = 0;
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
counter = counter + 1;
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.
```blocks
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
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.
```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
for (let i = 0; i < 25; i++) {
if (i % 2 > 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
let count = 0
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, 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, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, 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, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, 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, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
count = count + 1
})
@ -165,7 +165,7 @@ basic.forever(() => {
basic.showNumber(count)
})
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
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
serial.writeLine("started...")
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
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.
```sim
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showString("A");
});
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
basic.showString("B");
});
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Click), () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
basic.showString("0");
});
input.onPinTouchEvent(TouchPin.P1, input.buttonEventValue(ButtonEvent.Click), () => {
input.onPinTouchEvent(TouchPin.P1, ButtonEvent.Click, () => {
basic.showString("1");
});
input.onPinTouchEvent(TouchPin.P2, input.buttonEventValue(ButtonEvent.Click), () => {
input.onPinTouchEvent(TouchPin.P2, ButtonEvent.Click, () => {
basic.showString("2");
});
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
//Use button A for the next iteration of game of life
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
gameOfLife();
show();
})
//Use button B for reseting to random initial seed state
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
reset();
show();
})

View File

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

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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, 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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
if (Math.randomBoolean()) {
} else {
}
@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(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``.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
if (Math.randomBoolean()) {
basic.showIcon(IconNames.Skull)
} 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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showIcon(IconNames.Diamond)
basic.showIcon(IconNames.SmallDiamond)
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.
```blocks
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
});
```
@ -20,7 +20,7 @@ input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), ()
Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from `0` to `100` when pin **0** is pressed.
```blocks
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
basic.showNumber(randint(0, 100));
});
```
@ -34,7 +34,7 @@ Show ``"LOVE METER"`` on the screen when the @boardname@ starts.
```blocks
basic.showString("LOVE METER");
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
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@.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
radio.sendString("Yo");
});
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
})
```
@ -23,7 +23,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), functio
From the ``||basic:Basic||`` Toolbox drawer drag a ``||basic:show string||`` block into the ``||input:on button A pressed||`` block.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
basic.showString("Hello!")
})
```
@ -33,7 +33,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), functio
In the ``||basic:show string||`` block, type your name.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
basic.showString("My Name")
})
```
@ -43,7 +43,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), functio
Go to the simulator and test your name badge by pressing button **A**.
```sim
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
basic.showString("My Name")
})
```

View File

@ -123,7 +123,7 @@ basic.forever(function () {
**MakeCode blocks for the Robot Unicorn controller**
```blocks
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Down), function () {
input.onButtonEvent(Button.AB, ButtonEvent.Down, function () {
radio.sendNumber(4)
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
let pulseCount = 0
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), function () {
input.onButtonEvent(Button.A, ButtonEvent.Down, function () {
basic.showNumber(pulseCount)
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
});
```
@ -21,7 +21,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showLeds(`
# # . # #
# # . # #
@ -37,7 +37,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowny when button **B** is pressed.
```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
basic.showLeds(`
# # . # #
# # . # #
@ -53,7 +53,7 @@ input.onButtonEvent(Button.B, input.buttonEventValue(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.
```blocks
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
basic.showLeds(`
. . . . .
# . # . .

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -24,11 +24,11 @@ When you get tired of counting, press button `B` to reset the
```blocks
let item = 0;
basic.showNumber(item);
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
item = item + 1;
basic.showNumber(item);
});
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
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.
```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
basic.showNumber(game.score())
game.setScore(0)
})
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
game.addScore(1)
})
game.startCountdown(10000)

View File

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

View File

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

View File

@ -20,7 +20,7 @@ degrees -- exactly the opposite direction.
```blocks
let ball = game.createSprite(4, 2);
basic.showNumber(ball.get(LedSpriteProperty.Direction));
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
ball.ifOnEdgeBounce();
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.
```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), function () {
input.onButtonEvent(Button.B, ButtonEvent.Down, function () {
if (game.isPaused()) {
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
game.addScore(1);
basic.pause(500);
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.
```blocks
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
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``!
```blocks
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
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.
```block
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showString("My Name")
});
```
@ -23,7 +23,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(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.
```block
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showString("How are you?")
basic.showString(".....");
})
@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, input.buttonEventValue(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.
```block
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
basic.showString("How are you?")
basic.showString(".....");
basic.showLeds(`

View File

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

View File

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

View File

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

View File

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

View File

@ -159,7 +159,7 @@
"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|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|param|x": "Die erste Zahl",
"Math.imul|param|y": "Die zweite Zahl",
@ -220,7 +220,7 @@
"String.indexOf|param|start": "optionaler Startindex für die Suche",
"String.isEmpty": "Gibt einen Wert aus, der anzeigt, ob die Zeichenfolge leer ist",
"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\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\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|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",
@ -234,23 +234,23 @@
"String.substr": "Gibt eine Teilzeichenfolge der aktuellen Zeichenfolge aus.",
"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.toLowerCase": "Konvertiert die Zeichenfolge in Kleinbuchstaben.",
"String.trim": "Gibt eine Zeichenkette aus deraktuellen Zeichenkette zurück, welche die Leerzeichen von beiden Enden entfernt hat",
"String@type": "Kombinieren, trennen und suchen von Text-Zeichenfolgen.",
"StringMap": "Ein Wörterbuch von String-Schlüsseln zu String-Werten",
"_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": "Der Wert, der die vorherige Sequenz abschließt. Dieser Wert wird nicht im Ergebnis angezeigt.",
"_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": "Der Wert, der die vorherige Sequenz abschließt. Dieser Wert wird nicht im Ergebnis angezeigt",
"_py.slice": "Gibt einen Abschnitt eines Arrays gemäß Pythons erweiterter Slice Syntax zurück",
"_py.stringSlice": "Gibt einen Abschnitt einer Zeichenkette gemäß Pythons erweiterter Slice Syntax zurück",
"String.toLowerCase": "Converts the string to lower case characters.",
"String.trim": "Return a substring of the current string with whitespace removed from both ends",
"String@type": "Combine, split, and search text strings.",
"StringMap": "A dictionary from string key to string values",
"_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|param|first": "The value to end the sequence before. This value will not show up in the result.",
"_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|stop": "The value to end the sequence before. This value will not show up in the result",
"_py.slice": "Returns a section of an array according to python's extended slice syntax",
"_py.stringSlice": "Returns a section of a string according to python's extended slice syntax",
"basic": "Bietet Zugriff auf grundlegende mini-Funktionalität.",
"basic.clearScreen": "Schalte alle LEDs aus",
"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.pause": "Pausiere für die angegebene Zeit in Millisekunden",
"basic.pause|param|ms": "wie lange pausieren, z.B.: 100, 200, 500, 1000, 2000",
"basic.plotLeds": "Zeichnet ein Bild auf der LED-Matrix.",
"basic.plotLeds": "Zeichnet ein Bild auf dem LED-Bildschirm.",
"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|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|param|interval": "Zeit in Millisekunden zwischen jedem Neuzeichnen",
"basic.showAnimation|param|leds": "Muster der LEDs, die ein-/ und ausgeschaltet werden",
"basic.showArrow": "Zeigt einen Pfeil auf der LED-Matrix an",
"basic.showArrow|param|direction": "die Richtung des Pfeils",
"basic.showArrow|param|interval": "die Zeitspanne (in Millisekunden), in der das Symbol angezeigt wird. Die Standardeinstellung ist 600.",
"basic.showCompass": "Zeichnet eine Nadel, die immer nach Norden zeigt",
"basic.showCompass|param|interval": "die Zeitspanne (in Millisekunden), in der die Nadel angezeigt wird. Die Standardeinstellung ist 600.",
"basic.showIcon": "Zeichnet das ausgewählte Symbol auf der LED-Matrix",
"basic.showIcon|param|icon": "die vordefinierte Matrix-ID",
"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 der LED-Matrix.",
"basic.showArrow": "Draws an arrow on the LED screen",
"basic.showArrow|param|direction": "the direction of the arrow",
"basic.showArrow|param|interval": "the amount of time (milliseconds) to show the icon. Default is 600.",
"basic.showCompass": "Draws needle on the screen which always points to north",
"basic.showCompass|param|interval": "the amount of time (milliseconds) to show the needle. Default is 600.",
"basic.showIcon": "Draws the selected icon on the LED screen",
"basic.showIcon|param|icon": "the predefined icon id",
"basic.showIcon|param|interval": "the amount of time (milliseconds) to block the LED Matrix for showing the icon. Default is 600.",
"basic.showLeds": "Zeichnet ein Bild auf dem LED-Bildschirm.",
"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.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.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": "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|param|interval": "Wie schnell die Zeichen geändert werden; z.B. 150, 100, 200,-100",
"basic.showString|param|text": "Text auf LED-Matrix dargestellt werden soll, z.B.: \"Hi!\"",
"basic.turnRgbLedOff": "Legt die Farbe der eingebauten RGB-LED fest. Setze auf 0, um diese abzuschalten.",
"console": "Lesen und Schreiben von Daten in die Konsolenausgabe.",
"console.addListener": "Fügt einen Listener für die Log-Nachrichten hinzu",
"console.inspect": "Konvertiert ein beliebigen Objekts oder Wert in einen String",
"console.inspect|param|maxElements": "[optional] max. Zahlenwerte in einem Objekt, das in die Ausgabe eingeschlossen werden soll",
"basic.showString|param|text": "Text auf dem Bildschirm dargestellt werden soll, z.B.: \"Hi!\"",
"basic.turnRgbLedOff": "Sets the color on the build-in LED. Set to 0 to turn off.",
"console": "Reading and writing data to the console output.",
"console.addListener": "Adds a listener for the log messages",
"console.inspect": "Convert any object or value to a string representation",
"console.inspect|param|maxElements": "[optional] max number values in an object to include in output",
"console.inspect|param|obj": "value to be converted to a string",
"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.",
@ -335,37 +335,37 @@
"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.",
"game": "Eine Einzel-LED-Sprite-Spielumgebung",
"game.LedSprite": "Ein Spiel-Sprite, der als einzelne LED gerendert wird",
"game.LedSprite.blink": "Meldet die ``Blink``-Dauer eines Sprites",
"game.LedSprite.brightness": "Meldet die ``Helligkeit`` eines Sprites auf dem LED-Bildschirm",
"game.LedSprite.change": "Ändert eine Eigenschaft des Sprites",
"game.LedSprite.changeBlinkBy": "Ändert die ``Blink``-Dauer um die angegebene Anzahl an Millisekunden",
"game.LedSprite": "A game sprite rendered as a single LED",
"game.LedSprite.blink": "Reports the ``blink`` duration of a sprite",
"game.LedSprite.brightness": "Reports the ``brightness` of a sprite on the LED screen",
"game.LedSprite.change": "Changes a property of the sprite",
"game.LedSprite.changeBlinkBy": "Changes the ``blink`` duration by the given amount of millisecons",
"game.LedSprite.changeBlinkBy|param|ms": "TODO",
"game.LedSprite.changeBrightnessBy": "Ändert die ``Y``-Position um die angegebene Anzahl",
"game.LedSprite.changeBrightnessBy|param|value": "der Wert zum Ändern der Helligkeit",
"game.LedSprite.changeDirectionBy": "Ändert die Position der ``Richtung`` um die angegebene Anzahl durch Drehen nach rechts",
"game.LedSprite.changeBrightnessBy": "Changes the ``y`` position by the given amount",
"game.LedSprite.changeBrightnessBy|param|value": "the value to change brightness",
"game.LedSprite.changeDirectionBy": "Changes the ``direction`` position by the given amount by turning right",
"game.LedSprite.changeDirectionBy|param|angle": "TODO",
"game.LedSprite.changeXBy": "Ändert die ``X``-Position um die angegebene Anzahl",
"game.LedSprite.changeXBy": "Changes the ``x`` position by the given amount",
"game.LedSprite.changeXBy|param|x": "TODO",
"game.LedSprite.changeYBy": "Ändert die ``Y``-Position um die angegebene Anzahl",
"game.LedSprite.changeYBy": "Changes the ``y`` position by the given amount",
"game.LedSprite.changeYBy|param|y": "TODO",
"game.LedSprite.change|param|property": "der Name der Eigenschaft zum Ändern",
"game.LedSprite.change|param|value": "Anzahl der Veränderung, z. B.: 1",
"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": "Meldet die aktuelle Richtung eines Sprites",
"game.LedSprite.get": "Ruft eine Eigenschaft des Sprites ab",
"game.LedSprite.get|param|property": "der Name der Eigenschaft zum Ändern",
"game.LedSprite.goTo": "Gehe zu dieser Position auf dem Bildschirm",
"game.LedSprite.change|param|property": "the name of the property to change",
"game.LedSprite.change|param|value": "amount of change, eg: 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.direction": "Reports the current direction of a sprite",
"game.LedSprite.get": "Gets a property of the sprite",
"game.LedSprite.get|param|property": "the name of the property to change",
"game.LedSprite.goTo": "Go to this position on the screen",
"game.LedSprite.goTo|param|x": "TODO",
"game.LedSprite.goTo|param|y": "TODO",
"game.LedSprite.ifOnEdgeBounce": "Wenn der Bildschirmrand berührt wird und die Sichtrichtung geradeaus ist, wegdrehen.",
"game.LedSprite.isDeleted": "Meldet, ob der Sprite aus der Spiele-Engine gelöscht wurde.",
"game.LedSprite.isTouching": "Meldet wahr, wenn der Sprite dieselbe Position hat wie der angegebene Sprite",
"game.LedSprite.isTouchingEdge": "Meldet wahr, wenn der Sprite einen Rand berührt",
"game.LedSprite.isTouching|param|other": "der andere Sprite, um Überlagerung oder Berührung zu überprüfen",
"game.LedSprite.move": "Bewege eine bestimmte Anzahl von LEDs in die aktuelle Richtung",
"game.LedSprite.move|param|leds": "Anzahl der zu bewegenden LEDs, z. B.: 1, -1",
"game.LedSprite.off": "Schaltet den Sprite aus (bei Standardeinstellung ein)",
"game.LedSprite.ifOnEdgeBounce": "If touching the edge of the stage and facing towards it, then turn away.",
"game.LedSprite.isDeleted": "Reports whether the sprite has been deleted from the game engine.",
"game.LedSprite.isTouching": "Reports true if sprite has the same position as specified sprite",
"game.LedSprite.isTouchingEdge": "Reports true if sprite is touching an edge",
"game.LedSprite.isTouching|param|other": "the other sprite to check overlap or touch",
"game.LedSprite.move": "Move a certain number of LEDs in the current direction",
"game.LedSprite.move|param|leds": "number of leds to move, eg: 1, -1",
"game.LedSprite.off": "Turns off 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.setBlink": "Sets the blink duration interval in millisecond.",

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

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

View File

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

View File

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

View File

@ -1,23 +1,3 @@
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
*/
@ -30,7 +10,7 @@ namespace input {
*/
//% help=input/button-event
//% weight=19 blockId="control_button_event_value" block="%id"
//% advanced=true
//% shim=TD_ID advanced=true
//% group="Events"
export function buttonEventValue(id: ButtonEvent): number {
return id;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,13 +1,4 @@
{
"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",
"icon": "./static/packages/radio-broadcast/icon.png"
}

View File

@ -1,18 +1,4 @@
{
"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",
"icon": "./static/packages/radio/icon.png",
"yotta": {
@ -24,4 +10,4 @@
}
}
}
}
}

View File

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

View File

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

52
package-lock.json generated
View File

@ -1,16 +1,16 @@
{
"name": "pxt-calliopemini",
"version": "4.0.30",
"version": "4.0.28",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "pxt-calliopemini",
"version": "4.0.30",
"version": "4.0.28",
"license": "MIT",
"dependencies": {
"pxt-common-packages": "9.0.1",
"pxt-core": "7.0.16"
"pxt-core": "7.0.17"
},
"devDependencies": {
"@types/marked": "0.3.0",
@ -3015,9 +3015,9 @@
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
},
"node_modules/json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="
},
"node_modules/json-schema-traverse": {
"version": "0.4.1",
@ -3077,17 +3077,17 @@
}
},
"node_modules/jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"engines": [
"node >=0.6.0"
],
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
"dependencies": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"json-schema": "0.4.0",
"verror": "1.10.0"
},
"engines": {
"node": ">=0.6.0"
}
},
"node_modules/jsprim/node_modules/assert-plus": {
@ -5283,9 +5283,9 @@
}
},
"node_modules/pxt-core": {
"version": "7.0.16",
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-7.0.16.tgz",
"integrity": "sha512-fXSubuU46s6zVxlDfrswYvgTcZiPf+a3um5aTMcwYeVWnSug09+X/agsNnbZZBmAsavUygYLlaDKzmnBXTozMQ==",
"version": "7.0.17",
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-7.0.17.tgz",
"integrity": "sha512-a9PTiUAkINhTODyJ4JDddYuIY1ptF7LCW+6QAaNmOyhx3W1sqLL32rG++Ia+RK6+gd/aqrfduxXJ0Ke+P1u0mg==",
"dependencies": {
"@microsoft/immersive-reader-sdk": "1.1.0",
"applicationinsights-js": "^1.0.20",
@ -9154,9 +9154,9 @@
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw=="
},
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz",
"integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="
},
"json-schema-traverse": {
"version": "0.4.1",
@ -9204,13 +9204,13 @@
}
},
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"json-schema": "0.4.0",
"verror": "1.10.0"
},
"dependencies": {
@ -10913,9 +10913,9 @@
}
},
"pxt-core": {
"version": "7.0.16",
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-7.0.16.tgz",
"integrity": "sha512-fXSubuU46s6zVxlDfrswYvgTcZiPf+a3um5aTMcwYeVWnSug09+X/agsNnbZZBmAsavUygYLlaDKzmnBXTozMQ==",
"version": "7.0.17",
"resolved": "https://registry.npmjs.org/pxt-core/-/pxt-core-7.0.17.tgz",
"integrity": "sha512-a9PTiUAkINhTODyJ4JDddYuIY1ptF7LCW+6QAaNmOyhx3W1sqLL32rG++Ia+RK6+gd/aqrfduxXJ0Ke+P1u0mg==",
"requires": {
"@microsoft/immersive-reader-sdk": "1.1.0",
"applicationinsights-js": "^1.0.20",

View File

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

View File

@ -105,21 +105,13 @@
"basic\\s*\\.\\s*showArrow\\s*\\(": "basic.showIcon(",
"images\\s*\\.\\s*arrowImage\\s*\\(": "images.iconImage(",
"ArrowNames\\s*\\.\\s*": "IconNames.Arrow",
"input\\s*\\.\\s*onButtonPressed\\s*\\(\\s*(.*?),": "input.onButtonEvent($1, input.buttonEventValue(ButtonEvent.Click),",
"input\\s*\\.\\s*onPinPressed\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, input.buttonEventValue(ButtonEvent.Down),",
"input\\s*\\.\\s*onPinReleased\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, input.buttonEventValue(ButtonEvent.Up),",
"input\\s*\\.\\s*onButtonPressed\\s*\\(\\s*(.*?),": "input.onButtonEvent($1, ButtonEvent.Click,",
"input\\s*\\.\\s*onPinPressed\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, ButtonEvent.Down,",
"input\\s*\\.\\s*onPinReleased\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, ButtonEvent.Up,",
"input\\s*\\.\\s*loudness\\s*\\(": "input.soundLevel(",
"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": [{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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