Compare commits
4 Commits
dependabot
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
b0af4b54b2 | ||
|
5aade18a66 | ||
|
77ed2ccfb1 | ||
|
1aaedf1fa0 |
2
.github/workflows/pxt-buildmain.yml
vendored
2
.github/workflows/pxt-buildmain.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x]
|
||||
node-version: [18.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
2
.github/workflows/pxt-buildpr.yml
vendored
2
.github/workflows/pxt-buildpr.yml
vendored
@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x]
|
||||
node-version: [18.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
2
.github/workflows/pxt-buildpush.yml
vendored
2
.github/workflows/pxt-buildpush.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [8.x]
|
||||
node-version: [18.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
basic.showString("Hi!");
|
||||
})
|
||||
```
|
||||
```typescript
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
led.stopAnimation();
|
||||
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();
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
let x = randint(0, 5)
|
||||
if(x < 5) {
|
||||
basic.showString("low");
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
if(input.lightLevel()<100){
|
||||
led.setBrightness(255);
|
||||
}
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
for(let i = 0; i < 5; ++i) {
|
||||
basic.showNumber(i)
|
||||
}
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
let index = 4;
|
||||
while(index >= 0) {
|
||||
led.plot(index, index);
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
basic.showString("Hello!")
|
||||
})
|
||||
led.setBrightness(50)
|
||||
|
@ -59,7 +59,7 @@ A counter is a great example:
|
||||
|
||||
```blocks
|
||||
let counter = 0;
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
counter = counter + 1;
|
||||
basic.showNumber(counter);
|
||||
});
|
||||
|
@ -38,7 +38,7 @@ Each time the crocodile clip is firmly connected and disconnected from pin `P0`,
|
||||
the @boardname@ will return a random Number between 0 and the parameter limit.
|
||||
|
||||
```blocks
|
||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
||||
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
basic.showNumber(randint(0, 10))
|
||||
})
|
||||
```
|
||||
|
@ -63,7 +63,7 @@ for (let i = 0; i < values.length; i++) {
|
||||
The ``||led:plot bar graph||`` also sends the number value it's plotting to the console. You can see the output in the Data Viewer. It charts the values and they appear as individual numbers in console.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
for (let i = 0; i < 25; i++) {
|
||||
if (i % 2 > 0) {
|
||||
led.plotBarGraph(0, 0)
|
||||
|
@ -51,7 +51,7 @@ The first job of the scheduler is to allow multiple *subprograms* to be queued u
|
||||
```typescript
|
||||
let count = 0
|
||||
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count++;
|
||||
})
|
||||
|
||||
@ -74,7 +74,7 @@ The second statement informs the scheduler that on each and every event of the *
|
||||
// statement 1
|
||||
let count = 0
|
||||
// statement 2
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count++;
|
||||
})
|
||||
```
|
||||
@ -85,7 +85,7 @@ The third statement queues a `forever` loop for later execution by the scheduler
|
||||
// statement 1
|
||||
let count = 0
|
||||
// statement 2
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count++;
|
||||
})
|
||||
// statement 3
|
||||
@ -157,7 +157,7 @@ As a result, you can easily add a new capability to the micro:bit by just adding
|
||||
```typescript
|
||||
let count = 0
|
||||
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count = count + 1
|
||||
})
|
||||
|
||||
@ -165,7 +165,7 @@ basic.forever(() => {
|
||||
basic.showNumber(count)
|
||||
})
|
||||
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
count = 0
|
||||
})
|
||||
```
|
||||
|
@ -6,7 +6,7 @@ The code below shows a simple script that sends a line when the BBC micro:bit st
|
||||
|
||||
```blocks
|
||||
serial.writeLine("started...")
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
serial.writeLine("A pressed")
|
||||
})
|
||||
```
|
||||
|
@ -4,19 +4,19 @@ The JavaScript simulator allows you to test and execute most BBC micro:bit progr
|
||||
It allows you to emulate sensor data or user interactions.
|
||||
|
||||
```sim
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("A");
|
||||
});
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("B");
|
||||
});
|
||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
|
||||
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("0");
|
||||
});
|
||||
input.onPinTouchEvent(TouchPin.P1, ButtonEvent.Click, () => {
|
||||
input.onPinTouchEvent(TouchPin.P1, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("1");
|
||||
});
|
||||
input.onPinTouchEvent(TouchPin.P2, ButtonEvent.Click, () => {
|
||||
input.onPinTouchEvent(TouchPin.P2, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("2");
|
||||
});
|
||||
input.temperature()
|
||||
|
@ -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, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
gameOfLife();
|
||||
show();
|
||||
})
|
||||
|
||||
//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();
|
||||
show();
|
||||
})
|
||||
|
@ -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, 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.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
if (Math.randomBoolean()) {
|
||||
} 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``.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(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, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showIcon(IconNames.Diamond)
|
||||
basic.showIcon(IconNames.SmallDiamond)
|
||||
basic.showIcon(IconNames.Diamond)
|
||||
|
@ -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, 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.
|
||||
|
||||
```blocks
|
||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
||||
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(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, ButtonEvent.Down, () => {
|
||||
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
basic.showNumber(randint(0, 100));
|
||||
});
|
||||
```
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
radio.sendString("Yo");
|
||||
});
|
||||
radio.onReceivedString(function (receivedString) {
|
||||
|
@ -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, 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.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||
basic.showString("Hello!")
|
||||
})
|
||||
```
|
||||
@ -33,7 +33,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
||||
In the ``||basic:show string||`` block, type your name.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||
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**.
|
||||
|
||||
```sim
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||
basic.showString("My Name")
|
||||
})
|
||||
```
|
||||
|
@ -123,7 +123,7 @@ basic.forever(function () {
|
||||
**MakeCode blocks for the Robot Unicorn controller**
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.AB, ButtonEvent.Down, function () {
|
||||
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Down), function () {
|
||||
radio.sendNumber(4)
|
||||
basic.showLeds(`
|
||||
# . . . #
|
||||
|
@ -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, ButtonEvent.Down, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), function () {
|
||||
basic.showNumber(pulseCount)
|
||||
pulseCount = 0
|
||||
})
|
||||
|
@ -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, 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.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
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.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
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.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
# . # . .
|
||||
|
@ -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, ButtonEvent.Click, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(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, ButtonEvent.Click, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||
if (sprite.get(LedSpriteProperty.X) == 2) {
|
||||
game.addScore(1)
|
||||
} else {
|
||||
|
@ -24,7 +24,7 @@ bluetooth.stopAdvertising();
|
||||
## Example: stop advertising on button pressed
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
bluetooth.stopAdvertising();
|
||||
})
|
||||
```
|
||||
|
@ -27,7 +27,7 @@ bluetooth.onBluetoothDisconnected(() => {
|
||||
basic.showString("D");
|
||||
connected = 0;
|
||||
});
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
if (connected == 1) {
|
||||
bluetooth.uartWriteLine("HELLO");
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ bluetooth.onBluetoothDisconnected(() => {
|
||||
basic.showString("D");
|
||||
connected = 0;
|
||||
});
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
if (connected == 1) {
|
||||
bluetooth.uartWriteString("HELLO");
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ control.inBackground(() => {
|
||||
basic.pause(100)
|
||||
}
|
||||
})
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
num++;
|
||||
})
|
||||
```
|
||||
@ -42,7 +42,7 @@ let num = 0
|
||||
basic.forever(() => {
|
||||
basic.showNumber(num)
|
||||
})
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
num++;
|
||||
})
|
||||
```
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
item = item + 1;
|
||||
basic.showNumber(item);
|
||||
});
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
control.reset();
|
||||
});
|
||||
```
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
basic.showNumber(game.score())
|
||||
game.setScore(0)
|
||||
})
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
```
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
game.startCountdown(10000)
|
||||
|
@ -27,7 +27,7 @@ let img = images.createImage(`
|
||||
. . . . .
|
||||
`)
|
||||
img.showImage(0)
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
img.clear()
|
||||
img.showImage(0)
|
||||
})
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
basic.showString("YOU WIN!");
|
||||
});
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
game.gameOver();
|
||||
});
|
||||
```
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
ball.ifOnEdgeBounce();
|
||||
basic.showNumber(ball.get(LedSpriteProperty.Direction));
|
||||
});
|
||||
|
@ -15,7 +15,7 @@ game.isPaused()
|
||||
Resume the game if it's paused and button **B** is pressed.
|
||||
|
||||
```blocks
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Down, function () {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), function () {
|
||||
if (game.isPaused()) {
|
||||
game.resume()
|
||||
}
|
||||
|
@ -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, ButtonEvent.Down, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||
game.addScore(1);
|
||||
basic.pause(500);
|
||||
basic.showNumber(game.score());
|
||||
|
@ -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, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(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, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showLeds(`
|
||||
# # . # #
|
||||
# # . # #
|
||||
|
@ -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, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
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.
|
||||
|
||||
```block
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("How are you?")
|
||||
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.
|
||||
|
||||
```block
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
basic.showString("How are you?")
|
||||
basic.showString(".....");
|
||||
basic.showLeds(`
|
||||
|
@ -57,7 +57,7 @@ You could simply save the light measurements in an array like this:
|
||||
|
||||
```blocks
|
||||
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++) {
|
||||
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, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(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, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(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, ButtonEvent.Click, () => {
|
||||
dataReady = true;
|
||||
})
|
||||
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
if (dataReady) {
|
||||
serial.writeLine("Transferring file: DARKNESS, Length: " + darkness.length + " bytes...");
|
||||
serial.writeBuffer(darkness)
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "{0} block",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
},
|
||||
"description": "",
|
||||
"files": [
|
||||
"main.blocks",
|
||||
"main.ts",
|
||||
|
@ -1,6 +1,9 @@
|
||||
{
|
||||
"name": "bluetooth",
|
||||
"description": "Bluetooth services",
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"enums.d.ts",
|
||||
@ -10,13 +13,10 @@
|
||||
"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": {
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "{0} block",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"core": "file:../core",
|
||||
"bluetooth": "file:../bluetooth"
|
||||
},
|
||||
"description": "",
|
||||
"files": [
|
||||
"main.blocks",
|
||||
"main.ts",
|
||||
|
12
libs/core/enums.d.ts
vendored
12
libs/core/enums.d.ts
vendored
@ -39,21 +39,11 @@ declare namespace basic {
|
||||
}
|
||||
|
||||
|
||||
declare const enum ButtonEvent {
|
||||
//% blockIdentity="input.buttonEventValueId"
|
||||
//% block="pressed down"
|
||||
declare const enum ButtonEvents {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -323,9 +323,9 @@ namespace game {
|
||||
}
|
||||
|
||||
function unplugEvents(): void {
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { });
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { });
|
||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => { });
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => { });
|
||||
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
control.reset();
|
||||
});
|
||||
}
|
||||
|
@ -7,21 +7,11 @@ enum class Button {
|
||||
AB = MICROBIT_ID_BUTTON_AB,
|
||||
};
|
||||
|
||||
enum class ButtonEvent {
|
||||
//% blockIdentity="input.buttonEventValueId"
|
||||
//% block="pressed down"
|
||||
enum class ButtonEvents {
|
||||
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,
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
*/
|
||||
@ -10,7 +30,7 @@ namespace input {
|
||||
*/
|
||||
//% help=input/button-event
|
||||
//% weight=19 blockId="control_button_event_value" block="%id"
|
||||
//% shim=TD_ID advanced=true
|
||||
//% advanced=true
|
||||
//% group="Events"
|
||||
export function buttonEventValue(id: ButtonEvent): number {
|
||||
return id;
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "core",
|
||||
"description": "The microbit core library",
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
|
||||
"dependencies": {},
|
||||
"files": [
|
||||
"README.md",
|
||||
"platform.h",
|
||||
@ -76,7 +76,7 @@
|
||||
],
|
||||
"testFiles": [],
|
||||
"public": true,
|
||||
"dependencies": {},
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
|
||||
"dalDTS": {
|
||||
"compileServiceVariant": "mbcodal",
|
||||
"includeDirs": [
|
||||
@ -172,5 +172,6 @@
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"partial": true
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
{
|
||||
"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",
|
||||
@ -8,12 +12,8 @@
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
{
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
|
||||
"name": "microphone",
|
||||
"description": "The microphone library",
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"microphone.cpp",
|
||||
@ -7,8 +11,10 @@
|
||||
"enums.d.ts",
|
||||
"shims.d.ts"
|
||||
],
|
||||
"hidden": true,
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
}
|
||||
"testFiles": [
|
||||
"test.ts"
|
||||
],
|
||||
"public": true,
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
|
||||
"hidden": true
|
||||
}
|
||||
|
@ -22,10 +22,10 @@ enum RadioMessage {
|
||||
heart,
|
||||
skull
|
||||
}
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||
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.onReceivedMessage(RadioMessage.heart, function () {
|
||||
|
@ -20,10 +20,10 @@ enum RadioMessage {
|
||||
heart,
|
||||
skull
|
||||
}
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||
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.onReceivedMessage(RadioMessage.heart, function () {
|
||||
|
@ -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",
|
||||
"icon": "./static/packages/radio-broadcast/icon.png"
|
||||
}
|
||||
|
@ -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",
|
||||
"icon": "./static/packages/radio/icon.png",
|
||||
"yotta": {
|
||||
@ -10,4 +24,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,16 @@
|
||||
{
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo",
|
||||
"name": "servo",
|
||||
"description": "A micro-servo library",
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
},
|
||||
"files": [
|
||||
"README.md",
|
||||
"servo.ts",
|
||||
"ns.ts",
|
||||
"targetoverrides.ts"
|
||||
],
|
||||
"icon": "./static/packages/servo/icon.png",
|
||||
"public": true,
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
}
|
||||
}
|
||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo",
|
||||
"icon": "./static/packages/servo/icon.png"
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
{
|
||||
"name": "{0} bit",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"core": "file:../core",
|
||||
"radio": "file:../radio"
|
||||
},
|
||||
"description": "",
|
||||
"files": [
|
||||
"main.ts",
|
||||
"README.md"
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "pxt-calliopemini",
|
||||
"version": "4.0.29",
|
||||
"version": "4.0.30",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "pxt-calliopemini",
|
||||
"version": "4.0.29",
|
||||
"version": "4.0.30",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pxt-common-packages": "9.0.1",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-calliopemini",
|
||||
"version": "4.0.29",
|
||||
"version": "4.0.30",
|
||||
"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.18"
|
||||
"pxt-core": "7.0.22"
|
||||
}
|
||||
}
|
||||
|
@ -105,13 +105,21 @@
|
||||
"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, 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*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*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": [{
|
||||
|
@ -18,40 +18,47 @@
|
||||
"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",
|
||||
@ -79,10 +86,16 @@
|
||||
"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",
|
||||
@ -122,7 +135,8 @@
|
||||
"sparkfun/pxt-gator-temp",
|
||||
"tinysuperlab/motionkit",
|
||||
"tinysuperlab/touchkit",
|
||||
"vengit/pxt-sbrick"
|
||||
"vengit/pxt-sbrick",
|
||||
"CalliTGS3/pxt-calliope-grovePCF85063TP"
|
||||
],
|
||||
"preferredRepos": [
|
||||
"calliope-edu/CO2-Sensor-SCD40",
|
||||
@ -156,8 +170,7 @@
|
||||
"MKleinSB/pxt-serialmp3",
|
||||
"Microsoft/pxt-microturtle",
|
||||
"Microsoft/pxt-neopixel",
|
||||
"dl1ekm/pxt-calliope-ADS1x15",
|
||||
"dl1ekm/pxt-calliope-PCF85063-RTC"
|
||||
"CalliTGS3/pxt-calliope-grovePCF85063TP"
|
||||
]
|
||||
},
|
||||
"galleries": {
|
||||
|
@ -7,7 +7,7 @@ let level: number
|
||||
let swapSpeed: number
|
||||
|
||||
initializeGame()
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
if (ballRevealing) {
|
||||
index = index + 1
|
||||
if (index > 2) {
|
||||
@ -16,7 +16,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
basic.showString(cupSelect[index], 150)
|
||||
}
|
||||
})
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
if (ballRevealing) {
|
||||
ballRevealing = false
|
||||
if (correctBall == index) {
|
||||
|
@ -18,7 +18,7 @@ counter = 0
|
||||
pause = 700
|
||||
led.plot(oneX, oneY)
|
||||
led.plot(twoX, twoY)
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
if (oneX > 0) {
|
||||
led.unplot(oneX, oneY)
|
||||
led.unplot(twoX, twoY)
|
||||
@ -28,7 +28,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
led.plot(twoX, twoY)
|
||||
}
|
||||
})
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
if (twoX < 4) {
|
||||
led.unplot(oneX, oneY)
|
||||
led.unplot(twoX, twoY)
|
||||
|
@ -107,12 +107,12 @@ basic.forever(() => {
|
||||
basic.pause(500)
|
||||
}
|
||||
})
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
let temp = Math.abs(person.dirX) * (-1)
|
||||
person.dirX = Math.abs(person.dirY) * (-1)
|
||||
person.dirY = temp
|
||||
})
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
let temp1 = Math.abs(person.dirX)
|
||||
person.dirX = Math.abs(person.dirY)
|
||||
person.dirY = temp1
|
||||
|
@ -24,13 +24,13 @@ playOneGame(gameTime)
|
||||
showFinalScores(scoreA, scoreB)
|
||||
|
||||
function startIOMonitor() {
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
AWasPressed = true
|
||||
})
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
BWasPressed = true
|
||||
})
|
||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
ABWasPressed = true
|
||||
AWasPressed = false
|
||||
BWasPressed = false
|
||||
|
@ -501,13 +501,13 @@ function convertPenaltyTimeToScore(penaltyTime: number): number {
|
||||
}
|
||||
|
||||
function startIOMonitor() {
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
AWasPressed = true
|
||||
})
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
BWasPressed = true
|
||||
})
|
||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
ABWasPressed = true
|
||||
})
|
||||
input.onShake(() => {
|
||||
|
@ -377,11 +377,11 @@ function beepNTimesFor(times: number, duration: number) {
|
||||
|
||||
function startIOMonitor() {
|
||||
aWasPressed = false
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
aWasPressed = true
|
||||
})
|
||||
bWasPressed = false
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
bWasPressed = true
|
||||
})
|
||||
wasTweezers = false
|
||||
|
@ -476,10 +476,10 @@ function testTiltZ() {
|
||||
}
|
||||
|
||||
function startIOMonitor() {
|
||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
AWasPressed = true
|
||||
})
|
||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||
BWasPressed = true
|
||||
})
|
||||
input.onShake(() => {
|
||||
|
@ -82,6 +82,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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) {
|
||||
|
Loading…
Reference in New Issue
Block a user