V4 updates (#210)
* update pxt.json files * Fix button event enums fixes https://github.com/microsoft/pxt-calliope/issues/206 * Fix Safari CSS Rule for iOS app fixes https://github.com/microsoft/pxt-calliope/issues/205 * aprove preffered repos should fix https://github.com/microsoft/pxt-calliope/issues/167
This commit is contained in:
parent
1aaedf1fa0
commit
77ed2ccfb1
@ -26,12 +26,12 @@ The Calliope mini is packaged with sensors, radio and other goodies. Learn about
|
|||||||
You can program the Calliope mini using [Blocks](/blocks) or [JavaScript](/javascript) in your web browser via the [Calliope mini APIs](/reference):
|
You can program the Calliope mini using [Blocks](/blocks) or [JavaScript](/javascript) in your web browser via the [Calliope mini APIs](/reference):
|
||||||
|
|
||||||
```block
|
```block
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showString("Hi!");
|
basic.showString("Hi!");
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
```typescript
|
```typescript
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showString("Hi!");
|
basic.showString("Hi!");
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -54,7 +54,7 @@ The simulator has support for the LED screen, buttons, as well as compass, accel
|
|||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
basic.showString("Hi!");
|
basic.showString("Hi!");
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
led.stopAnimation();
|
led.stopAnimation();
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. . . . .
|
. . . . .
|
||||||
@ -63,7 +63,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
|||||||
# . . . #
|
# . . . #
|
||||||
. # # # .`);
|
. # # # .`);
|
||||||
});
|
});
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
led.stopAnimation();
|
led.stopAnimation();
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. # . # .
|
. # . # .
|
||||||
|
@ -17,7 +17,7 @@ if (led.point(1,1) && led.point(2,2)) {
|
|||||||
When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below:
|
When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
let x = randint(0, 5)
|
let x = randint(0, 5)
|
||||||
if(x < 5) {
|
if(x < 5) {
|
||||||
basic.showString("low");
|
basic.showString("low");
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed:
|
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255` when the button A is pressed:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
if(input.lightLevel()<100){
|
if(input.lightLevel()<100){
|
||||||
led.setBrightness(255);
|
led.setBrightness(255);
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen.
|
This program will show the numbers 0, 1, 2, 3, and 4 one after another on the LED screen.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
for(let i = 0; i < 5; ++i) {
|
for(let i = 0; i < 5; ++i) {
|
||||||
basic.showNumber(i)
|
basic.showNumber(i)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
The following example uses a while loop to make a diagonal line on the LED screen (points `0, 0`, `1, 1`, `2, 2`, `3, 3`, `4, 4`).
|
The following example uses a while loop to make a diagonal line on the LED screen (points `0, 0`, `1, 1`, `2, 2`, `3, 3`, `4, 4`).
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
let index = 4;
|
let index = 4;
|
||||||
while(index >= 0) {
|
while(index >= 0) {
|
||||||
led.plot(index, index);
|
led.plot(index, index);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
In this example, ``on start`` sets a dimmer brightness on the screen and the button handler shows a string.
|
In this example, ``on start`` sets a dimmer brightness on the screen and the button handler shows a string.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showString("Hello!")
|
basic.showString("Hello!")
|
||||||
})
|
})
|
||||||
led.setBrightness(50)
|
led.setBrightness(50)
|
||||||
|
@ -59,7 +59,7 @@ A counter is a great example:
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
counter = counter + 1;
|
counter = counter + 1;
|
||||||
basic.showNumber(counter);
|
basic.showNumber(counter);
|
||||||
});
|
});
|
||||||
|
@ -38,7 +38,7 @@ Each time the crocodile clip is firmly connected and disconnected from pin `P0`,
|
|||||||
the @boardname@ will return a random Number between 0 and the parameter limit.
|
the @boardname@ will return a random Number between 0 and the parameter limit.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showNumber(randint(0, 10))
|
basic.showNumber(randint(0, 10))
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -63,7 +63,7 @@ for (let i = 0; i < values.length; i++) {
|
|||||||
The ``||led:plot bar graph||`` also sends the number value it's plotting to the console. You can see the output in the Data Viewer. It charts the values and they appear as individual numbers in console.
|
The ``||led:plot bar graph||`` also sends the number value it's plotting to the console. You can see the output in the Data Viewer. It charts the values and they appear as individual numbers in console.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
for (let i = 0; i < 25; i++) {
|
for (let i = 0; i < 25; i++) {
|
||||||
if (i % 2 > 0) {
|
if (i % 2 > 0) {
|
||||||
led.plotBarGraph(0, 0)
|
led.plotBarGraph(0, 0)
|
||||||
|
@ -51,7 +51,7 @@ The first job of the scheduler is to allow multiple *subprograms* to be queued u
|
|||||||
```typescript
|
```typescript
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
count++;
|
count++;
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ The second statement informs the scheduler that on each and every event of the *
|
|||||||
// statement 1
|
// statement 1
|
||||||
let count = 0
|
let count = 0
|
||||||
// statement 2
|
// statement 2
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
count++;
|
count++;
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -85,7 +85,7 @@ The third statement queues a `forever` loop for later execution by the scheduler
|
|||||||
// statement 1
|
// statement 1
|
||||||
let count = 0
|
let count = 0
|
||||||
// statement 2
|
// statement 2
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
count++;
|
count++;
|
||||||
})
|
})
|
||||||
// statement 3
|
// statement 3
|
||||||
@ -157,7 +157,7 @@ As a result, you can easily add a new capability to the micro:bit by just adding
|
|||||||
```typescript
|
```typescript
|
||||||
let count = 0
|
let count = 0
|
||||||
|
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
count = count + 1
|
count = count + 1
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -165,7 +165,7 @@ basic.forever(() => {
|
|||||||
basic.showNumber(count)
|
basic.showNumber(count)
|
||||||
})
|
})
|
||||||
|
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
count = 0
|
count = 0
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -6,7 +6,7 @@ The code below shows a simple script that sends a line when the BBC micro:bit st
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
serial.writeLine("started...")
|
serial.writeLine("started...")
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
serial.writeLine("A pressed")
|
serial.writeLine("A pressed")
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -4,19 +4,19 @@ The JavaScript simulator allows you to test and execute most BBC micro:bit progr
|
|||||||
It allows you to emulate sensor data or user interactions.
|
It allows you to emulate sensor data or user interactions.
|
||||||
|
|
||||||
```sim
|
```sim
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("A");
|
basic.showString("A");
|
||||||
});
|
});
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("B");
|
basic.showString("B");
|
||||||
});
|
});
|
||||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Click, () => {
|
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("0");
|
basic.showString("0");
|
||||||
});
|
});
|
||||||
input.onPinTouchEvent(TouchPin.P1, ButtonEvent.Click, () => {
|
input.onPinTouchEvent(TouchPin.P1, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("1");
|
basic.showString("1");
|
||||||
});
|
});
|
||||||
input.onPinTouchEvent(TouchPin.P2, ButtonEvent.Click, () => {
|
input.onPinTouchEvent(TouchPin.P2, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("2");
|
basic.showString("2");
|
||||||
});
|
});
|
||||||
input.temperature()
|
input.temperature()
|
||||||
|
@ -22,13 +22,13 @@ Here's a program that simulates cell life in the LED matrix. Use button ``A`` fo
|
|||||||
let lifeChart: Image = null
|
let lifeChart: Image = null
|
||||||
|
|
||||||
//Use button A for the next iteration of game of life
|
//Use button A for the next iteration of game of life
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
gameOfLife();
|
gameOfLife();
|
||||||
show();
|
show();
|
||||||
})
|
})
|
||||||
|
|
||||||
//Use button B for reseting to random initial seed state
|
//Use button B for reseting to random initial seed state
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
reset();
|
reset();
|
||||||
show();
|
show();
|
||||||
})
|
})
|
||||||
|
@ -11,7 +11,7 @@ Let's create a coin flipping program to simulate a real coin toss. We'll use ico
|
|||||||
Get an ``||input:on button A pressed||`` block from the ``||input:Input||`` drawer in the toolbox. We'll put our coin flipping code in here.
|
Get an ``||input:on button A pressed||`` block from the ``||input:Input||`` drawer in the toolbox. We'll put our coin flipping code in here.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ Grab an ``||logic:if else||`` block and set it inside ``||input:on button A pres
|
|||||||
The ``||Math:pick random true or false||`` returns a random ``true`` or ``false`` value which we use to determine a ``heads`` or ``tails`` result for a coin toss.
|
The ``||Math:pick random true or false||`` returns a random ``true`` or ``false`` value which we use to determine a ``heads`` or ``tails`` result for a coin toss.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
if (Math.randomBoolean()) {
|
if (Math.randomBoolean()) {
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
Now, put a ``||basic:show icon||`` block inside both the ``||logic:if||`` and the ``||logic:else||``. Pick images to mean ``heads`` and ``tails``.
|
Now, put a ``||basic:show icon||`` block inside both the ``||logic:if||`` and the ``||logic:else||``. Pick images to mean ``heads`` and ``tails``.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
if (Math.randomBoolean()) {
|
if (Math.randomBoolean()) {
|
||||||
basic.showIcon(IconNames.Skull)
|
basic.showIcon(IconNames.Skull)
|
||||||
} else {
|
} else {
|
||||||
@ -52,7 +52,7 @@ Press button **A** in the simulator to try the coin toss code.
|
|||||||
You can animate the coin toss to add the feeling of suspense. Place different ``||basic:show icon||`` blocks before the ``||logic:if||`` to show that the coin is flipping.
|
You can animate the coin toss to add the feeling of suspense. Place different ``||basic:show icon||`` blocks before the ``||logic:if||`` to show that the coin is flipping.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showIcon(IconNames.Diamond)
|
basic.showIcon(IconNames.Diamond)
|
||||||
basic.showIcon(IconNames.SmallDiamond)
|
basic.showIcon(IconNames.SmallDiamond)
|
||||||
basic.showIcon(IconNames.Diamond)
|
basic.showIcon(IconNames.Diamond)
|
||||||
|
@ -11,7 +11,7 @@ Make a love meter, how sweet! The @boardname@ is feeling the love, then sometime
|
|||||||
Let's build a **LOVE METER** machine. Place an ``||input:on pin pressed||`` block to run code when pin **0** is pressed. Use ``P0`` from the list of pin inputs.
|
Let's build a **LOVE METER** machine. Place an ``||input:on pin pressed||`` block to run code when pin **0** is pressed. Use ``P0`` from the list of pin inputs.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
|||||||
Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from `0` to `100` when pin **0** is pressed.
|
Using ``||basic:show number||`` and ``||Math:pick random||`` blocks, show a random number from `0` to `100` when pin **0** is pressed.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showNumber(randint(0, 100));
|
basic.showNumber(randint(0, 100));
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -34,7 +34,7 @@ Show ``"LOVE METER"`` on the screen when the @boardname@ starts.
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.showString("LOVE METER");
|
basic.showString("LOVE METER");
|
||||||
input.onPinTouchEvent(TouchPin.P0, ButtonEvent.Down, () => {
|
input.onPinTouchEvent(TouchPin.P0, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showNumber(randint(0, 100));
|
basic.showNumber(randint(0, 100));
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
@ -12,7 +12,7 @@ Use ``||input:on button pressed||`` to send a text message over radio with ``||r
|
|||||||
Every @boardname@ nearby will receive this message.
|
Every @boardname@ nearby will receive this message.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
radio.sendString("Yo");
|
radio.sendString("Yo");
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -41,7 +41,7 @@ radio.onReceivedString(function (receivedString) {
|
|||||||
Press button **A** on the simulator, you will notice that a second @boardname@ appears (if your screen is too small, the simulator might decide not to show it). Try pressing **A** again and notice that the "Yo" message gets displayed on the other @boardname@.
|
Press button **A** on the simulator, you will notice that a second @boardname@ appears (if your screen is too small, the simulator might decide not to show it). Try pressing **A** again and notice that the "Yo" message gets displayed on the other @boardname@.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
radio.sendString("Yo");
|
radio.sendString("Yo");
|
||||||
});
|
});
|
||||||
radio.onReceivedString(function (receivedString) {
|
radio.onReceivedString(function (receivedString) {
|
||||||
|
@ -13,7 +13,7 @@ First, let's get your name to display on the screen.
|
|||||||
From the ``||input:Input||`` Toolbox drawer, drag an ``||input:on button A pressed||`` block onto the Workspace.
|
From the ``||input:Input||`` Toolbox drawer, drag an ``||input:on button A pressed||`` block onto the Workspace.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
|
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -23,7 +23,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
|||||||
From the ``||basic:Basic||`` Toolbox drawer drag a ``||basic:show string||`` block into the ``||input:on button A pressed||`` block.
|
From the ``||basic:Basic||`` Toolbox drawer drag a ``||basic:show string||`` block into the ``||input:on button A pressed||`` block.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
basic.showString("Hello!")
|
basic.showString("Hello!")
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -33,7 +33,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
|||||||
In the ``||basic:show string||`` block, type your name.
|
In the ``||basic:show string||`` block, type your name.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
basic.showString("My Name")
|
basic.showString("My Name")
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -43,7 +43,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
|||||||
Go to the simulator and test your name badge by pressing button **A**.
|
Go to the simulator and test your name badge by pressing button **A**.
|
||||||
|
|
||||||
```sim
|
```sim
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
basic.showString("My Name")
|
basic.showString("My Name")
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -123,7 +123,7 @@ basic.forever(function () {
|
|||||||
**MakeCode blocks for the Robot Unicorn controller**
|
**MakeCode blocks for the Robot Unicorn controller**
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.AB, ButtonEvent.Down, function () {
|
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Down), function () {
|
||||||
radio.sendNumber(4)
|
radio.sendNumber(4)
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
# . . . #
|
# . . . #
|
||||||
|
@ -83,7 +83,7 @@ Now that we are detecting pulses, we can use a variable to count them too. In th
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let pulseCount = 0
|
let pulseCount = 0
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), function () {
|
||||||
basic.showNumber(pulseCount)
|
basic.showNumber(pulseCount)
|
||||||
pulseCount = 0
|
pulseCount = 0
|
||||||
})
|
})
|
||||||
|
@ -12,7 +12,7 @@ Code the buttons on the @boardname@ to show that it's happy or sad.
|
|||||||
Place a ``||input:on button pressed||`` block to run code when button **A** is pressed.
|
Place a ``||input:on button pressed||`` block to run code when button **A** is pressed.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen. Press the **A** button in the simulator to see the smiley.
|
Place a ``||basic:show leds||`` block inside ``||input:on button pressed||`` to display a smiley on the screen. Press the **A** button in the simulator to see the smiley.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
# # . # #
|
# # . # #
|
||||||
# # . # #
|
# # . # #
|
||||||
@ -37,7 +37,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowny when button **B** is pressed.
|
Add ``||input:on button pressed||`` and ``||basic:show leds||`` blocks to display a frowny when button **B** is pressed.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
# # . # #
|
# # . # #
|
||||||
# # . # #
|
# # . # #
|
||||||
@ -53,7 +53,7 @@ input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
|||||||
Add a secret mode that happens when **A** and **B** are pressed together. For this case, add multiple ``||basic:show leds||`` blocks to create an animation.
|
Add a secret mode that happens when **A** and **B** are pressed together. For this case, add multiple ``||basic:show leds||`` blocks to create an animation.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. . . . .
|
. . . . .
|
||||||
# . # . .
|
# . # . .
|
||||||
|
@ -59,7 +59,7 @@ Use a ``||input:on button pressed||`` block to handle the **A** button. Put in a
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let sprite = game.createSprite(2, 2)
|
let sprite = game.createSprite(2, 2)
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
if (sprite.get(LedSpriteProperty.X) == 2) {
|
if (sprite.get(LedSpriteProperty.X) == 2) {
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ Finally, pull out an ``||game:add score||`` and a ``||game:game over||`` block t
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let sprite = game.createSprite(2, 2)
|
let sprite = game.createSprite(2, 2)
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
if (sprite.get(LedSpriteProperty.X) == 2) {
|
if (sprite.get(LedSpriteProperty.X) == 2) {
|
||||||
game.addScore(1)
|
game.addScore(1)
|
||||||
} else {
|
} else {
|
||||||
|
@ -24,7 +24,7 @@ bluetooth.stopAdvertising();
|
|||||||
## Example: stop advertising on button pressed
|
## Example: stop advertising on button pressed
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
bluetooth.stopAdvertising();
|
bluetooth.stopAdvertising();
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -27,7 +27,7 @@ bluetooth.onBluetoothDisconnected(() => {
|
|||||||
basic.showString("D");
|
basic.showString("D");
|
||||||
connected = 0;
|
connected = 0;
|
||||||
});
|
});
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
if (connected == 1) {
|
if (connected == 1) {
|
||||||
bluetooth.uartWriteLine("HELLO");
|
bluetooth.uartWriteLine("HELLO");
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ bluetooth.onBluetoothDisconnected(() => {
|
|||||||
basic.showString("D");
|
basic.showString("D");
|
||||||
connected = 0;
|
connected = 0;
|
||||||
});
|
});
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
if (connected == 1) {
|
if (connected == 1) {
|
||||||
bluetooth.uartWriteString("HELLO");
|
bluetooth.uartWriteString("HELLO");
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ control.inBackground(() => {
|
|||||||
basic.pause(100)
|
basic.pause(100)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
num++;
|
num++;
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
@ -42,7 +42,7 @@ let num = 0
|
|||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
basic.showNumber(num)
|
basic.showNumber(num)
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
num++;
|
num++;
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -24,11 +24,11 @@ When you get tired of counting, press button `B` to reset the
|
|||||||
```blocks
|
```blocks
|
||||||
let item = 0;
|
let item = 0;
|
||||||
basic.showNumber(item);
|
basic.showNumber(item);
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
item = item + 1;
|
item = item + 1;
|
||||||
basic.showNumber(item);
|
basic.showNumber(item);
|
||||||
});
|
});
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
control.reset();
|
control.reset();
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
@ -16,11 +16,11 @@ Press button ``A`` as much as possible to increase the score.
|
|||||||
Press ``B`` to display the score and reset the score.
|
Press ``B`` to display the score and reset the score.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showNumber(game.score())
|
basic.showNumber(game.score())
|
||||||
game.setScore(0)
|
game.setScore(0)
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
game.addScore(1)
|
game.addScore(1)
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
@ -16,7 +16,7 @@ Press button ``A`` as much as possible.
|
|||||||
At the end of 10 seconds, the program will show your score.
|
At the end of 10 seconds, the program will show your score.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
game.addScore(1)
|
game.addScore(1)
|
||||||
})
|
})
|
||||||
game.startCountdown(10000)
|
game.startCountdown(10000)
|
||||||
|
@ -27,7 +27,7 @@ let img = images.createImage(`
|
|||||||
. . . . .
|
. . . . .
|
||||||
`)
|
`)
|
||||||
img.showImage(0)
|
img.showImage(0)
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
img.clear()
|
img.clear()
|
||||||
img.showImage(0)
|
img.showImage(0)
|
||||||
})
|
})
|
||||||
|
@ -14,10 +14,10 @@ If you press button `B`, it shows an animation and ends the game.
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.showString("PICK A BUTTON");
|
basic.showString("PICK A BUTTON");
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
basic.showString("YOU WIN!");
|
basic.showString("YOU WIN!");
|
||||||
});
|
});
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
game.gameOver();
|
game.gameOver();
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
@ -20,7 +20,7 @@ degrees -- exactly the opposite direction.
|
|||||||
```blocks
|
```blocks
|
||||||
let ball = game.createSprite(4, 2);
|
let ball = game.createSprite(4, 2);
|
||||||
basic.showNumber(ball.get(LedSpriteProperty.Direction));
|
basic.showNumber(ball.get(LedSpriteProperty.Direction));
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
ball.ifOnEdgeBounce();
|
ball.ifOnEdgeBounce();
|
||||||
basic.showNumber(ball.get(LedSpriteProperty.Direction));
|
basic.showNumber(ball.get(LedSpriteProperty.Direction));
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@ game.isPaused()
|
|||||||
Resume the game if it's paused and button **B** is pressed.
|
Resume the game if it's paused and button **B** is pressed.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Down, function () {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Down), function () {
|
||||||
if (game.isPaused()) {
|
if (game.isPaused()) {
|
||||||
game.resume()
|
game.resume()
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ This program adds one point to your score every time you press button
|
|||||||
second) and shows your score.
|
second) and shows your score.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Down), () => {
|
||||||
game.addScore(1);
|
game.addScore(1);
|
||||||
basic.pause(500);
|
basic.pause(500);
|
||||||
basic.showNumber(game.score());
|
basic.showNumber(game.score());
|
||||||
|
@ -13,7 +13,7 @@ basic.showString("Micro!")
|
|||||||
Well, the text stopped scrolling. Place the ``||basic:show string||`` block in the ``||input:on button pressed||`` slot to scroll your name when button **A** is pressed.
|
Well, the text stopped scrolling. Place the ``||basic:show string||`` block in the ``||input:on button pressed||`` slot to scroll your name when button **A** is pressed.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("Micro!")
|
basic.showString("Micro!")
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -25,7 +25,7 @@ Place some blocks to display a smiley when button **B** is pressed.
|
|||||||
Use the dropdown to find ``B``!
|
Use the dropdown to find ``B``!
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
# # . # #
|
# # . # #
|
||||||
# # . # #
|
# # . # #
|
||||||
|
@ -13,7 +13,7 @@ basic.showString("My Name")
|
|||||||
Well, you noticed that the text stopped. Place the ``||basic:show string||`` block in an ``||input:on button pressed||`` block to scroll your name whenever button **A** is pressed.
|
Well, you noticed that the text stopped. Place the ``||basic:show string||`` block in an ``||input:on button pressed||`` block to scroll your name whenever button **A** is pressed.
|
||||||
|
|
||||||
```block
|
```block
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("My Name")
|
basic.showString("My Name")
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
@ -23,7 +23,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
Ok, let's try to talk to the @boardname@ using a button. Change the text in ``||basic:show string||`` to ask the question "How are you?". Add another ``||basic:show string||`` with "....." to show that the @boardname@ is thinking.
|
Ok, let's try to talk to the @boardname@ using a button. Change the text in ``||basic:show string||`` to ask the question "How are you?". Add another ``||basic:show string||`` with "....." to show that the @boardname@ is thinking.
|
||||||
|
|
||||||
```block
|
```block
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("How are you?")
|
basic.showString("How are you?")
|
||||||
basic.showString(".....");
|
basic.showString(".....");
|
||||||
})
|
})
|
||||||
@ -34,7 +34,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
Now, make the @boardname@ give an answer with a smiley face! Find the ``||basic:show leds||`` and draw a smiley face on the block by clicking on the LEDs. Press button **A** in the simulator and see the @boardname@ respond to your question.
|
Now, make the @boardname@ give an answer with a smiley face! Find the ``||basic:show leds||`` and draw a smiley face on the block by clicking on the LEDs. Press button **A** in the simulator and see the @boardname@ respond to your question.
|
||||||
|
|
||||||
```block
|
```block
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
basic.showString("How are you?")
|
basic.showString("How are you?")
|
||||||
basic.showString(".....");
|
basic.showString(".....");
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
|
@ -57,7 +57,7 @@ You could simply save the light measurements in an array like this:
|
|||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let darkness: number[] = []
|
let darkness: number[] = []
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
for (let i = 0; i < 60 * 4; i++) {
|
for (let i = 0; i < 60 * 4; i++) {
|
||||||
darkness.push(input.lightLevel())
|
darkness.push(input.lightLevel())
|
||||||
basic.pause(60000)
|
basic.pause(60000)
|
||||||
@ -77,7 +77,7 @@ The code in blocks for recording the light level is modified to make our file da
|
|||||||
|
|
||||||
```typescript-ignore
|
```typescript-ignore
|
||||||
let darkness = pins.createBuffer(60 * 4);
|
let darkness = pins.createBuffer(60 * 4);
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
for (let i = 0; i < 60 * 4; i++) {
|
for (let i = 0; i < 60 * 4; i++) {
|
||||||
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
|
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
|
||||||
basic.pause(60000)
|
basic.pause(60000)
|
||||||
@ -90,7 +90,7 @@ Later, we can upload the file to the laptop computer by pressing the **B** butto
|
|||||||
```typescript-ignore
|
```typescript-ignore
|
||||||
let dataReady = false;
|
let dataReady = false;
|
||||||
let darkness = pins.createBuffer(60 * 4);
|
let darkness = pins.createBuffer(60 * 4);
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
for (let i = 0; i < 60 * 4; i++) {
|
for (let i = 0; i < 60 * 4; i++) {
|
||||||
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
|
darkness.setNumber(NumberFormat.UInt8LE, i, input.lightLevel())
|
||||||
basic.pause(60000)
|
basic.pause(60000)
|
||||||
@ -98,7 +98,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
dataReady = true;
|
dataReady = true;
|
||||||
})
|
})
|
||||||
|
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
if (dataReady) {
|
if (dataReady) {
|
||||||
serial.writeLine("Transferring file: DARKNESS, Length: " + darkness.length + " bytes...");
|
serial.writeLine("Transferring file: DARKNESS, Length: " + darkness.length + " bytes...");
|
||||||
serial.writeBuffer(darkness)
|
serial.writeBuffer(darkness)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "{0} block",
|
"name": "{0} block",
|
||||||
|
"description": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core": "file:../core"
|
"core": "file:../core"
|
||||||
},
|
},
|
||||||
"description": "",
|
|
||||||
"files": [
|
"files": [
|
||||||
"main.blocks",
|
"main.blocks",
|
||||||
"main.ts",
|
"main.ts",
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "bluetooth",
|
"name": "bluetooth",
|
||||||
"description": "Bluetooth services",
|
"description": "Bluetooth services",
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
"enums.d.ts",
|
"enums.d.ts",
|
||||||
@ -10,13 +13,10 @@
|
|||||||
"BLEHF2Service.h",
|
"BLEHF2Service.h",
|
||||||
"BLEHF2Service.cpp"
|
"BLEHF2Service.cpp"
|
||||||
],
|
],
|
||||||
|
"public": true,
|
||||||
"weight": 10,
|
"weight": 10,
|
||||||
"searchOnly": true,
|
"searchOnly": true,
|
||||||
"icon": "./static/packages/bluetooth/icon.png",
|
"icon": "./static/packages/bluetooth/icon.png",
|
||||||
"public": true,
|
|
||||||
"dependencies": {
|
|
||||||
"core": "file:../core"
|
|
||||||
},
|
|
||||||
"yotta": {
|
"yotta": {
|
||||||
"config": {
|
"config": {
|
||||||
"microbit-dal": {
|
"microbit-dal": {
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "{0} block",
|
"name": "{0} block",
|
||||||
|
"description": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core": "file:../core",
|
"core": "file:../core",
|
||||||
"bluetooth": "file:../bluetooth"
|
"bluetooth": "file:../bluetooth"
|
||||||
},
|
},
|
||||||
"description": "",
|
|
||||||
"files": [
|
"files": [
|
||||||
"main.blocks",
|
"main.blocks",
|
||||||
"main.ts",
|
"main.ts",
|
||||||
|
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 {
|
declare const enum ButtonEvents {
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="pressed down"
|
|
||||||
Down = 1, // MICROBIT_BUTTON_EVT_DOWN
|
Down = 1, // MICROBIT_BUTTON_EVT_DOWN
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="released up"
|
|
||||||
Up = 2, // MICROBIT_BUTTON_EVT_UP
|
Up = 2, // MICROBIT_BUTTON_EVT_UP
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="clicked"
|
|
||||||
Click = 3, // MICROBIT_BUTTON_EVT_CLICK
|
Click = 3, // MICROBIT_BUTTON_EVT_CLICK
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="long clicked"
|
|
||||||
LongClick = 4, // MICROBIT_BUTTON_EVT_LONG_CLICK
|
LongClick = 4, // MICROBIT_BUTTON_EVT_LONG_CLICK
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="hold"
|
|
||||||
Hold = 5, // MICROBIT_BUTTON_EVT_HOLD
|
Hold = 5, // MICROBIT_BUTTON_EVT_HOLD
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,9 +323,9 @@ namespace game {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function unplugEvents(): void {
|
function unplugEvents(): void {
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => { });
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => { });
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => { });
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => { });
|
||||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
control.reset();
|
control.reset();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -7,21 +7,11 @@ enum class Button {
|
|||||||
AB = MICROBIT_ID_BUTTON_AB,
|
AB = MICROBIT_ID_BUTTON_AB,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ButtonEvent {
|
enum class ButtonEvents {
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="pressed down"
|
|
||||||
Down = MICROBIT_BUTTON_EVT_DOWN,
|
Down = MICROBIT_BUTTON_EVT_DOWN,
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="released up"
|
|
||||||
Up = MICROBIT_BUTTON_EVT_UP,
|
Up = MICROBIT_BUTTON_EVT_UP,
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="clicked"
|
|
||||||
Click = MICROBIT_BUTTON_EVT_CLICK,
|
Click = MICROBIT_BUTTON_EVT_CLICK,
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="long clicked"
|
|
||||||
LongClick = MICROBIT_BUTTON_EVT_LONG_CLICK,
|
LongClick = MICROBIT_BUTTON_EVT_LONG_CLICK,
|
||||||
//% blockIdentity="input.buttonEventValueId"
|
|
||||||
//% block="hold"
|
|
||||||
Hold = MICROBIT_BUTTON_EVT_HOLD,
|
Hold = MICROBIT_BUTTON_EVT_HOLD,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,3 +1,23 @@
|
|||||||
|
enum ButtonEvent {
|
||||||
|
//% blockIdentity="input.buttonEventValueId"
|
||||||
|
//% block="pressed down"
|
||||||
|
Down = ButtonEvents.Down,
|
||||||
|
//% blockIdentity="input.buttonEventValueId"
|
||||||
|
//% block="released up"
|
||||||
|
Up = ButtonEvents.Up,
|
||||||
|
//% blockIdentity="input.buttonEventValueId"
|
||||||
|
//% block="clicked"
|
||||||
|
Click = ButtonEvents.Click,
|
||||||
|
//% blockIdentity="input.buttonEventValueId"
|
||||||
|
//% block="long clicked"
|
||||||
|
LongClick = ButtonEvents.LongClick,
|
||||||
|
//% blockIdentity="input.buttonEventValueId"
|
||||||
|
//% block="hold"
|
||||||
|
Hold = ButtonEvents.Hold,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Events and data from sensors
|
* Events and data from sensors
|
||||||
*/
|
*/
|
||||||
@ -10,7 +30,7 @@ namespace input {
|
|||||||
*/
|
*/
|
||||||
//% help=input/button-event
|
//% help=input/button-event
|
||||||
//% weight=19 blockId="control_button_event_value" block="%id"
|
//% weight=19 blockId="control_button_event_value" block="%id"
|
||||||
//% shim=TD_ID advanced=true
|
//% advanced=true
|
||||||
//% group="Events"
|
//% group="Events"
|
||||||
export function buttonEventValue(id: ButtonEvent): number {
|
export function buttonEventValue(id: ButtonEvent): number {
|
||||||
return id;
|
return id;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "core",
|
"name": "core",
|
||||||
"description": "The microbit core library",
|
"description": "The microbit core library",
|
||||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
|
"dependencies": {},
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
"platform.h",
|
"platform.h",
|
||||||
@ -76,7 +76,7 @@
|
|||||||
],
|
],
|
||||||
"testFiles": [],
|
"testFiles": [],
|
||||||
"public": true,
|
"public": true,
|
||||||
"dependencies": {},
|
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/base",
|
||||||
"dalDTS": {
|
"dalDTS": {
|
||||||
"compileServiceVariant": "mbcodal",
|
"compileServiceVariant": "mbcodal",
|
||||||
"includeDirs": [
|
"includeDirs": [
|
||||||
@ -172,5 +172,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
}
|
"partial": true
|
||||||
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "devices",
|
"name": "devices",
|
||||||
"description": "BETA - Camera, remote control and other Bluetooth services. App required.",
|
"description": "BETA - Camera, remote control and other Bluetooth services. App required.",
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core",
|
||||||
|
"bluetooth": "file:../bluetooth"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
"enums.d.ts",
|
"enums.d.ts",
|
||||||
@ -8,12 +12,8 @@
|
|||||||
"devices.cpp",
|
"devices.cpp",
|
||||||
"devices.ts"
|
"devices.ts"
|
||||||
],
|
],
|
||||||
|
"public": true,
|
||||||
"icon": "./static/packages/devices/icon.png",
|
"icon": "./static/packages/devices/icon.png",
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
"public": true,
|
|
||||||
"dependencies": {
|
|
||||||
"core": "file:../core",
|
|
||||||
"bluetooth": "file:../bluetooth"
|
|
||||||
},
|
|
||||||
"installedVersion": "ljipgq"
|
"installedVersion": "ljipgq"
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
|
"name": "microphone",
|
||||||
|
"description": "The microphone library",
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
"microphone.cpp",
|
"microphone.cpp",
|
||||||
@ -7,8 +11,10 @@
|
|||||||
"enums.d.ts",
|
"enums.d.ts",
|
||||||
"shims.d.ts"
|
"shims.d.ts"
|
||||||
],
|
],
|
||||||
"hidden": true,
|
"testFiles": [
|
||||||
"dependencies": {
|
"test.ts"
|
||||||
"core": "file:../core"
|
],
|
||||||
}
|
"public": true,
|
||||||
|
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
|
||||||
|
"hidden": true
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@ enum RadioMessage {
|
|||||||
heart,
|
heart,
|
||||||
skull
|
skull
|
||||||
}
|
}
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
radio.sendMessage(RadioMessage.heart)
|
radio.sendMessage(RadioMessage.heart)
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
radio.sendMessage(RadioMessage.skull)
|
radio.sendMessage(RadioMessage.skull)
|
||||||
})
|
})
|
||||||
radio.onReceivedMessage(RadioMessage.heart, function () {
|
radio.onReceivedMessage(RadioMessage.heart, function () {
|
||||||
|
@ -20,10 +20,10 @@ enum RadioMessage {
|
|||||||
heart,
|
heart,
|
||||||
skull
|
skull
|
||||||
}
|
}
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
radio.sendMessage(RadioMessage.heart)
|
radio.sendMessage(RadioMessage.heart)
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, function () {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
|
||||||
radio.sendMessage(RadioMessage.skull)
|
radio.sendMessage(RadioMessage.skull)
|
||||||
})
|
})
|
||||||
radio.onReceivedMessage(RadioMessage.heart, function () {
|
radio.onReceivedMessage(RadioMessage.heart, function () {
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
{
|
{
|
||||||
|
"name": "radio-broadcast",
|
||||||
|
"description": "Adds new blocks for message communication in the radio category",
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core",
|
||||||
|
"radio": "file:../radio"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"radio-broadcast.ts"
|
||||||
|
],
|
||||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio-broadcast",
|
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio-broadcast",
|
||||||
"icon": "./static/packages/radio-broadcast/icon.png"
|
"icon": "./static/packages/radio-broadcast/icon.png"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,18 @@
|
|||||||
{
|
{
|
||||||
|
"name": "radio",
|
||||||
|
"description": "The radio services",
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"README.md",
|
||||||
|
"shims.d.ts",
|
||||||
|
"enums.d.ts",
|
||||||
|
"radio.cpp",
|
||||||
|
"radio.ts",
|
||||||
|
"targetoverrides.ts"
|
||||||
|
],
|
||||||
|
"public": true,
|
||||||
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio",
|
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/radio",
|
||||||
"icon": "./static/packages/radio/icon.png",
|
"icon": "./static/packages/radio/icon.png",
|
||||||
"yotta": {
|
"yotta": {
|
||||||
@ -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": [
|
"files": [
|
||||||
"README.md",
|
"README.md",
|
||||||
"servo.ts",
|
"servo.ts",
|
||||||
"ns.ts",
|
"ns.ts",
|
||||||
"targetoverrides.ts"
|
"targetoverrides.ts"
|
||||||
],
|
],
|
||||||
"icon": "./static/packages/servo/icon.png",
|
|
||||||
"public": true,
|
"public": true,
|
||||||
"dependencies": {
|
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/servo",
|
||||||
"core": "file:../core"
|
"icon": "./static/packages/servo/icon.png"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
{
|
{
|
||||||
"name": "{0} bit",
|
"name": "{0} bit",
|
||||||
|
"description": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core": "file:../core",
|
"core": "file:../core",
|
||||||
"radio": "file:../radio"
|
"radio": "file:../radio"
|
||||||
},
|
},
|
||||||
"description": "",
|
|
||||||
"files": [
|
"files": [
|
||||||
"main.ts",
|
"main.ts",
|
||||||
"README.md"
|
"README.md"
|
||||||
|
@ -105,13 +105,21 @@
|
|||||||
"basic\\s*\\.\\s*showArrow\\s*\\(": "basic.showIcon(",
|
"basic\\s*\\.\\s*showArrow\\s*\\(": "basic.showIcon(",
|
||||||
"images\\s*\\.\\s*arrowImage\\s*\\(": "images.iconImage(",
|
"images\\s*\\.\\s*arrowImage\\s*\\(": "images.iconImage(",
|
||||||
"ArrowNames\\s*\\.\\s*": "IconNames.Arrow",
|
"ArrowNames\\s*\\.\\s*": "IconNames.Arrow",
|
||||||
"input\\s*\\.\\s*onButtonPressed\\s*\\(\\s*(.*?),": "input.onButtonEvent($1, ButtonEvent.Click,",
|
"input\\s*\\.\\s*onButtonPressed\\s*\\(\\s*(.*?),": "input.onButtonEvent($1, input.buttonEventValue(ButtonEvent.Click),",
|
||||||
"input\\s*\\.\\s*onPinPressed\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, ButtonEvent.Down,",
|
"input\\s*\\.\\s*onPinPressed\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, input.buttonEventValue(ButtonEvent.Down),",
|
||||||
"input\\s*\\.\\s*onPinReleased\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, ButtonEvent.Up,",
|
"input\\s*\\.\\s*onPinReleased\\s*\\(\\s*(.*?),": "input.onPinTouchEvent($1, input.buttonEventValue(ButtonEvent.Up),",
|
||||||
"input\\s*\\.\\s*loudness\\s*\\(": "input.soundLevel(",
|
"input\\s*\\.\\s*loudness\\s*\\(": "input.soundLevel(",
|
||||||
"basic\\s*\\.\\s*rgbw\\s*\\(\\s*(.*?),\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*\\)": "basic.rgb($1, $2, $3)"
|
"basic\\s*\\.\\s*rgbw\\s*\\(\\s*(.*?),\\s*(.*?),\\s*(.*?),\\s*(.*?)\\s*\\)": "basic.rgb($1, $2, $3)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"0.0.0 - 4.0.29": [
|
||||||
|
{
|
||||||
|
"type": "api",
|
||||||
|
"map": {
|
||||||
|
"input\\s*\\.\\s*onButtonEvent\\s*\\(\\s*(.*?),\\s*ButtonEvent\\s*.\\s*(.*?),": "input.onButtonEvent($1, input.buttonEventValue(ButtonEvent.$2),"
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"hidSelectors": [{
|
"hidSelectors": [{
|
||||||
|
@ -18,40 +18,47 @@
|
|||||||
"KitronikLtd/pxt-kitronik-rtc",
|
"KitronikLtd/pxt-kitronik-rtc",
|
||||||
"KitronikLtd/pxt-kitronik-servo-lite",
|
"KitronikLtd/pxt-kitronik-servo-lite",
|
||||||
"KitronikLtd/pxt-kitronik-stopbit",
|
"KitronikLtd/pxt-kitronik-stopbit",
|
||||||
|
"MKleinSB/pxt-MAX7219_8x8",
|
||||||
|
"MKleinSB/pxt-OLED-SSD1306",
|
||||||
|
"MKleinSB/pxt-OLEDpaint",
|
||||||
|
"MKleinSB/pxt-callibot",
|
||||||
|
"MKleinSB/pxt-callicolor",
|
||||||
|
"MKleinSB/pxt-callicross",
|
||||||
|
"MKleinSB/pxt-callimotor",
|
||||||
|
"MKleinSB/pxt-calliope-buttons",
|
||||||
|
"MKleinSB/pxt-CO2OLED",
|
||||||
|
"MKleinSB/pxt-dht11",
|
||||||
|
"MKleinSB/pxt-esp-thingspeak",
|
||||||
|
"MKleinSB/pxt-gatorlog-calliope",
|
||||||
|
"MKleinSB/pxt-huskylens",
|
||||||
|
"MKleinSB/pxt-kitronik-zip-tile-calliope",
|
||||||
|
"MKleinSB/pxt-mpr121",
|
||||||
|
"MKleinSB/pxt-pca9685",
|
||||||
|
"MKleinSB/pxt-seeed-temperature",
|
||||||
|
"MKleinSB/pxt-serialmp3",
|
||||||
|
"MKleinSB/pxt-KY-040",
|
||||||
"MKleinSB/ScrollText",
|
"MKleinSB/ScrollText",
|
||||||
"MKleinSB/pxt-BME680",
|
"MKleinSB/pxt-BME680",
|
||||||
"MKleinSB/pxt-IR-Calliope",
|
"MKleinSB/pxt-IR-Calliope",
|
||||||
"MKleinSB/pxt-MCP23017",
|
"MKleinSB/pxt-MCP23017",
|
||||||
"MKleinSB/pxt-OLED-SSD1306",
|
|
||||||
"MKleinSB/pxt-Seeed-Temperatursensor",
|
"MKleinSB/pxt-Seeed-Temperatursensor",
|
||||||
"MKleinSB/pxt-automationbit-calliope",
|
"MKleinSB/pxt-automationbit-calliope",
|
||||||
"MKleinSB/pxt-bc95",
|
"MKleinSB/pxt-bc95",
|
||||||
"MKleinSB/pxt-callibot",
|
|
||||||
"MKleinSB/pxt-callicolor",
|
|
||||||
"MKleinSB/pxt-callicross",
|
|
||||||
"MKleinSB/pxt-calliope-esp",
|
"MKleinSB/pxt-calliope-esp",
|
||||||
"MKleinSB/pxt-calliope-oled96",
|
"MKleinSB/pxt-calliope-oled96",
|
||||||
"MKleinSB/pxt-columbuseye",
|
"MKleinSB/pxt-columbuseye",
|
||||||
"MKleinSB/pxt-dht11",
|
|
||||||
"MKleinSB/pxt-envirobit",
|
"MKleinSB/pxt-envirobit",
|
||||||
"MKleinSB/pxt-esp-thingspeak",
|
|
||||||
"MKleinSB/pxt-fischertechnik-calliope",
|
"MKleinSB/pxt-fischertechnik-calliope",
|
||||||
"MKleinSB/pxt-foldio",
|
"MKleinSB/pxt-foldio",
|
||||||
"MKleinSB/pxt-ft-fototransistor-calliope",
|
"MKleinSB/pxt-ft-fototransistor-calliope",
|
||||||
"MKleinSB/pxt-gatorlog-calliope",
|
|
||||||
"MKleinSB/pxt-graphs",
|
"MKleinSB/pxt-graphs",
|
||||||
"MKleinSB/pxt-iot-environment-kit",
|
"MKleinSB/pxt-iot-environment-kit",
|
||||||
"MKleinSB/pxt-kitronik-robotics-board-calliope",
|
"MKleinSB/pxt-kitronik-robotics-board-calliope",
|
||||||
"MKleinSB/pxt-kitronik-zip-64",
|
"MKleinSB/pxt-kitronik-zip-64",
|
||||||
"MKleinSB/pxt-kitronik-zip-tile-calliope",
|
|
||||||
"MKleinSB/pxt-makerbit-motor-calliope",
|
"MKleinSB/pxt-makerbit-motor-calliope",
|
||||||
"MKleinSB/pxt-makerbit-touch",
|
"MKleinSB/pxt-makerbit-touch",
|
||||||
"MKleinSB/pxt-makerbit-ultrasonic-calliope",
|
"MKleinSB/pxt-makerbit-ultrasonic-calliope",
|
||||||
"MKleinSB/pxt-mpr121",
|
|
||||||
"MKleinSB/pxt-pca9685",
|
|
||||||
"MKleinSB/pxt-seeed-temperature",
|
|
||||||
"MKleinSB/pxt-serial-rb",
|
"MKleinSB/pxt-serial-rb",
|
||||||
"MKleinSB/pxt-serialmp3",
|
|
||||||
"MKleinSB/pxt-thumbjoystick-calliope",
|
"MKleinSB/pxt-thumbjoystick-calliope",
|
||||||
"Microsoft/pxt-bluetooth-max6675",
|
"Microsoft/pxt-bluetooth-max6675",
|
||||||
"Microsoft/pxt-bluetooth-midi",
|
"Microsoft/pxt-bluetooth-midi",
|
||||||
@ -79,10 +86,16 @@
|
|||||||
"alankrantas/pxt-ESP8266_ThingSpeak",
|
"alankrantas/pxt-ESP8266_ThingSpeak",
|
||||||
"assirati/pxt-inventura",
|
"assirati/pxt-inventura",
|
||||||
"calliope-edu/CO2-Sensor-SCD40",
|
"calliope-edu/CO2-Sensor-SCD40",
|
||||||
|
"calliope-edu/pxt-HM3301_Dust_Sensor",
|
||||||
"calliope-edu/pxt-SCD30",
|
"calliope-edu/pxt-SCD30",
|
||||||
"calliope-edu/pxt-TCS34725FN",
|
"calliope-edu/pxt-TCS34725FN",
|
||||||
|
"calliope-edu/pxt-display",
|
||||||
"calliope-edu/pxt-grove",
|
"calliope-edu/pxt-grove",
|
||||||
|
"calliope-edu/pxt-rgblcd",
|
||||||
"calliope-edu/pxt-sunlightsensor-si1145",
|
"calliope-edu/pxt-sunlightsensor-si1145",
|
||||||
|
"calliope-mini/pxt-SCD30",
|
||||||
|
"tinysuperlab/motionkit",
|
||||||
|
"tinysuperlab/touchkit",
|
||||||
"cgs-matthew-pham/pxt-hitechnic-irseeker-v2",
|
"cgs-matthew-pham/pxt-hitechnic-irseeker-v2",
|
||||||
"jcubuntu/pxt-iKB1",
|
"jcubuntu/pxt-iKB1",
|
||||||
"jdarling/pxt-pca9685",
|
"jdarling/pxt-pca9685",
|
||||||
@ -122,7 +135,9 @@
|
|||||||
"sparkfun/pxt-gator-temp",
|
"sparkfun/pxt-gator-temp",
|
||||||
"tinysuperlab/motionkit",
|
"tinysuperlab/motionkit",
|
||||||
"tinysuperlab/touchkit",
|
"tinysuperlab/touchkit",
|
||||||
"vengit/pxt-sbrick"
|
"vengit/pxt-sbrick",
|
||||||
|
"dl1ekm/pxt-calliope-ADS1x15",
|
||||||
|
"dl1ekm/pxt-calliope-PCF85063-RTC"
|
||||||
],
|
],
|
||||||
"preferredRepos": [
|
"preferredRepos": [
|
||||||
"calliope-edu/CO2-Sensor-SCD40",
|
"calliope-edu/CO2-Sensor-SCD40",
|
||||||
|
@ -7,7 +7,7 @@ let level: number
|
|||||||
let swapSpeed: number
|
let swapSpeed: number
|
||||||
|
|
||||||
initializeGame()
|
initializeGame()
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
if (ballRevealing) {
|
if (ballRevealing) {
|
||||||
index = index + 1
|
index = index + 1
|
||||||
if (index > 2) {
|
if (index > 2) {
|
||||||
@ -16,7 +16,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
basic.showString(cupSelect[index], 150)
|
basic.showString(cupSelect[index], 150)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
if (ballRevealing) {
|
if (ballRevealing) {
|
||||||
ballRevealing = false
|
ballRevealing = false
|
||||||
if (correctBall == index) {
|
if (correctBall == index) {
|
||||||
|
@ -18,7 +18,7 @@ counter = 0
|
|||||||
pause = 700
|
pause = 700
|
||||||
led.plot(oneX, oneY)
|
led.plot(oneX, oneY)
|
||||||
led.plot(twoX, twoY)
|
led.plot(twoX, twoY)
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
if (oneX > 0) {
|
if (oneX > 0) {
|
||||||
led.unplot(oneX, oneY)
|
led.unplot(oneX, oneY)
|
||||||
led.unplot(twoX, twoY)
|
led.unplot(twoX, twoY)
|
||||||
@ -28,7 +28,7 @@ input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
|||||||
led.plot(twoX, twoY)
|
led.plot(twoX, twoY)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
if (twoX < 4) {
|
if (twoX < 4) {
|
||||||
led.unplot(oneX, oneY)
|
led.unplot(oneX, oneY)
|
||||||
led.unplot(twoX, twoY)
|
led.unplot(twoX, twoY)
|
||||||
|
@ -107,12 +107,12 @@ basic.forever(() => {
|
|||||||
basic.pause(500)
|
basic.pause(500)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
let temp = Math.abs(person.dirX) * (-1)
|
let temp = Math.abs(person.dirX) * (-1)
|
||||||
person.dirX = Math.abs(person.dirY) * (-1)
|
person.dirX = Math.abs(person.dirY) * (-1)
|
||||||
person.dirY = temp
|
person.dirY = temp
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
let temp1 = Math.abs(person.dirX)
|
let temp1 = Math.abs(person.dirX)
|
||||||
person.dirX = Math.abs(person.dirY)
|
person.dirX = Math.abs(person.dirY)
|
||||||
person.dirY = temp1
|
person.dirY = temp1
|
||||||
|
@ -24,13 +24,13 @@ playOneGame(gameTime)
|
|||||||
showFinalScores(scoreA, scoreB)
|
showFinalScores(scoreA, scoreB)
|
||||||
|
|
||||||
function startIOMonitor() {
|
function startIOMonitor() {
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
AWasPressed = true
|
AWasPressed = true
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
BWasPressed = true
|
BWasPressed = true
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
ABWasPressed = true
|
ABWasPressed = true
|
||||||
AWasPressed = false
|
AWasPressed = false
|
||||||
BWasPressed = false
|
BWasPressed = false
|
||||||
|
@ -501,13 +501,13 @@ function convertPenaltyTimeToScore(penaltyTime: number): number {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startIOMonitor() {
|
function startIOMonitor() {
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
AWasPressed = true
|
AWasPressed = true
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
BWasPressed = true
|
BWasPressed = true
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.AB, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
ABWasPressed = true
|
ABWasPressed = true
|
||||||
})
|
})
|
||||||
input.onShake(() => {
|
input.onShake(() => {
|
||||||
|
@ -377,11 +377,11 @@ function beepNTimesFor(times: number, duration: number) {
|
|||||||
|
|
||||||
function startIOMonitor() {
|
function startIOMonitor() {
|
||||||
aWasPressed = false
|
aWasPressed = false
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
aWasPressed = true
|
aWasPressed = true
|
||||||
})
|
})
|
||||||
bWasPressed = false
|
bWasPressed = false
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
bWasPressed = true
|
bWasPressed = true
|
||||||
})
|
})
|
||||||
wasTweezers = false
|
wasTweezers = false
|
||||||
|
@ -476,10 +476,10 @@ function testTiltZ() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startIOMonitor() {
|
function startIOMonitor() {
|
||||||
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
AWasPressed = true
|
AWasPressed = true
|
||||||
})
|
})
|
||||||
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), () => {
|
||||||
BWasPressed = true
|
BWasPressed = true
|
||||||
})
|
})
|
||||||
input.onShake(() => {
|
input.onShake(() => {
|
||||||
|
@ -82,6 +82,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Safari Only for iPad and iPhone second rule
|
||||||
|
@supports (-webkit-touch-callout: none) {
|
||||||
|
#mainmenu .right.menu {
|
||||||
|
margin-right: 4rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Mobile */
|
/* Mobile */
|
||||||
@media only screen and (max-width: @largestMobileScreen) {
|
@media only screen and (max-width: @largestMobileScreen) {
|
||||||
|
Loading…
Reference in New Issue
Block a user