Merge branch 'master' of github.com:Microsoft/pxt-microbit
This commit is contained in:
commit
5b2e877aef
15
README.md
15
README.md
@ -9,12 +9,19 @@ PXT ([Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt
|
|||||||
|
|
||||||
## Local server
|
## Local server
|
||||||
|
|
||||||
|
The local server allows to run the editor and the documentation from your computer.
|
||||||
|
|
||||||
### Setup
|
### Setup
|
||||||
|
|
||||||
The following commands are a 1-time setup after synching the repo on your machine.
|
The following commands are a 1-time setup after synching the repo on your machine.
|
||||||
|
|
||||||
* clone this repo to your computer
|
* if not yet installed, install [Node.js 4.4.5 or higher](https://nodejs.org/en/download/)
|
||||||
* install the PXT command line
|
* [clone this repo](https://help.github.com/articles/cloning-a-repository/) to your computer and go in the project folder
|
||||||
|
```
|
||||||
|
git clone https://github.com/microsoft/pxt-microbit
|
||||||
|
cd pxt-microbit
|
||||||
|
```
|
||||||
|
* install the PXT command line (add ``sudo`` for Mac/Linux shells).
|
||||||
```
|
```
|
||||||
npm install -g pxt
|
npm install -g pxt
|
||||||
```
|
```
|
||||||
@ -37,7 +44,9 @@ If you need modify the `.cpp` files, turn on yotta compilation with the ``-yt``
|
|||||||
pxt serve -yt
|
pxt serve -yt
|
||||||
```
|
```
|
||||||
|
|
||||||
To make sure you're running the latest tools, run (add ``sudo`` for Mac/Linux shells)
|
## Updates
|
||||||
|
|
||||||
|
To update your PXT version and make sure you're running the latest tools, run (add ``sudo`` for Mac/Linux shells)
|
||||||
```
|
```
|
||||||
pxt update
|
pxt update
|
||||||
```
|
```
|
||||||
|
@ -86,7 +86,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
|
||||||
let x = math.random(5)
|
let x = Math.random(5)
|
||||||
if(x < 5) {
|
if(x < 5) {
|
||||||
basic.showString("low");
|
basic.showString("low");
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
Your beginning code should look like this:
|
Your beginning code should look like this:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let coll = (<string[]>[])
|
let coll: string[] = []
|
||||||
coll.push("puppy")
|
coll.push("puppy")
|
||||||
coll.push("clock")
|
coll.push("clock")
|
||||||
coll.push("night")
|
coll.push("night")
|
||||||
@ -27,7 +27,7 @@ game.startCountdown(30000)
|
|||||||
Let's add more words for the player to act out! But first, we need to increase the time in one round to give the player more time get through all the words. Let's change the `game->start countdown` statement.
|
Let's add more words for the player to act out! But first, we need to increase the time in one round to give the player more time get through all the words. Let's change the `game->start countdown` statement.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let coll = (<string[]>[])
|
let coll: string[] = []
|
||||||
coll.push("puppy")
|
coll.push("puppy")
|
||||||
coll.push("clock")
|
coll.push("clock")
|
||||||
coll.push("night")
|
coll.push("night")
|
||||||
@ -52,7 +52,8 @@ game.startCountdown(60000)
|
|||||||
Now let's add 5 more words to our list of charade words. Right above the the line `word:=coll->at(index)` add 5 lines that say `coll->add("")`. In this example, we will add the words **bicycle, telephone, sun, car, and ant** but you can add whatever words you like.
|
Now let's add 5 more words to our list of charade words. Right above the the line `word:=coll->at(index)` add 5 lines that say `coll->add("")`. In this example, we will add the words **bicycle, telephone, sun, car, and ant** but you can add whatever words you like.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let coll.push("puppy")
|
let coll: string[] = []
|
||||||
|
coll.push("puppy")
|
||||||
coll.push("clock")
|
coll.push("clock")
|
||||||
coll.push("night")
|
coll.push("night")
|
||||||
coll.push("cat")
|
coll.push("cat")
|
||||||
|
@ -19,7 +19,7 @@ A 'collection' is a group of variables of the same type stored together. A 'coll
|
|||||||
## 2. Consider the following lines of code.
|
## 2. Consider the following lines of code.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let coll = (<string[]>[])
|
let coll: string[] = []
|
||||||
coll.push("puppy")
|
coll.push("puppy")
|
||||||
coll.push("clock")
|
coll.push("clock")
|
||||||
```
|
```
|
||||||
@ -35,7 +35,7 @@ basic.showString(coll[0], 150)
|
|||||||
## 3. Consider the following lines of code.
|
## 3. Consider the following lines of code.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let coll = (<string[]>[])
|
let coll: string[] = []
|
||||||
coll.push("puppy")
|
coll.push("puppy")
|
||||||
coll.push("clock")
|
coll.push("clock")
|
||||||
coll.push("cat")
|
coll.push("cat")
|
||||||
@ -52,7 +52,7 @@ basic.showString(coll[2], 150)
|
|||||||
## 4. Consider the following line of code.
|
## 4. Consider the following line of code.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let coll = (<string[]>[])
|
let coll: string[] = []
|
||||||
```
|
```
|
||||||
|
|
||||||
Write the five (5) lines of code that will add the following five words to `data->coll`: puppy, clock, night, cat, cow.
|
Write the five (5) lines of code that will add the following five words to `data->coll`: puppy, clock, night, cat, cow.
|
||||||
@ -60,7 +60,8 @@ Write the five (5) lines of code that will add the following five words to `data
|
|||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let coll.push("puppy")
|
let coll: string[] = []
|
||||||
|
coll.push("puppy")
|
||||||
coll.push("clock")
|
coll.push("clock")
|
||||||
coll.push("night")
|
coll.push("night")
|
||||||
coll.push("cat")
|
coll.push("cat")
|
||||||
|
@ -211,7 +211,7 @@ Let's setup the logic for the food and the ghost to be in different quadrants. F
|
|||||||
let hero = game.createSprite(2, 2);
|
let hero = game.createSprite(2, 2);
|
||||||
let food = game.createSprite(4, 4);
|
let food = game.createSprite(4, 4);
|
||||||
let ghost = game.createSprite(0, 0);
|
let ghost = game.createSprite(0, 0);
|
||||||
let ghost.change(LedSpriteProperty.Blink, 100);
|
ghost.change(LedSpriteProperty.Blink, 100);
|
||||||
food = led.brightness() == 8;
|
food = led.brightness() == 8;
|
||||||
while (true) {
|
while (true) {
|
||||||
basic.pause(400);
|
basic.pause(400);
|
||||||
@ -265,7 +265,7 @@ while (true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
0.set(LedSpriteProperty.X, 4);
|
ghost.set(LedSpriteProperty.X, 4);
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -21,4 +21,4 @@ bluetooth.onBluetoothDisconnected(() => {
|
|||||||
|
|
||||||
```package
|
```package
|
||||||
microbit-bluetooth
|
microbit-bluetooth
|
||||||
```
|
```
|
||||||
|
@ -14,6 +14,7 @@ input.onPinPressed(TouchPin.P0, () => {
|
|||||||
});
|
});
|
||||||
input.buttonIsPressed(Button.A);
|
input.buttonIsPressed(Button.A);
|
||||||
input.compassHeading();
|
input.compassHeading();
|
||||||
|
input.pinIsPressed(TouchPin.P0);
|
||||||
input.temperature();
|
input.temperature();
|
||||||
input.acceleration(Dimension.X);
|
input.acceleration(Dimension.X);
|
||||||
input.lightLevel();
|
input.lightLevel();
|
||||||
@ -21,7 +22,6 @@ input.rotation(Rotation.Pitch);
|
|||||||
input.magneticForce(Dimension.X);
|
input.magneticForce(Dimension.X);
|
||||||
input.runningTime();
|
input.runningTime();
|
||||||
input.setAccelerometerRange(AcceleratorRange.OneG);
|
input.setAccelerometerRange(AcceleratorRange.OneG);
|
||||||
input.pinIsPressed(TouchPin.P0);
|
|
||||||
input.calibrate();
|
input.calibrate();
|
||||||
input.onLogoDown(() => {
|
input.onLogoDown(() => {
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](/device/screen). NOTE: `basic -> plot image` has been replaced by `basic -> show leds`.
|
Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](/device/screen). NOTE: `basic -> plot image` has been replaced by `basic -> show leds`.
|
||||||
|
|
||||||
```sig
|
```sig
|
||||||
basic.plotLeds(`
|
basic.showLeds(`
|
||||||
. . . . .
|
. . . . .
|
||||||
. # . # .
|
. # . # .
|
||||||
. . # . .
|
. . # . .
|
||||||
# ; . . #
|
# . . . #
|
||||||
. # # # .
|
. # # # .
|
||||||
`)
|
`)
|
||||||
```
|
```
|
||||||
@ -16,14 +16,14 @@ basic.plotLeds(`
|
|||||||
|
|
||||||
* leds - a series of LED on/off states that form an image (see steps below)
|
* leds - a series of LED on/off states that form an image (see steps below)
|
||||||
|
|
||||||
### Example: simley
|
### Example: smiley
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.plotLeds(`
|
basic.showLeds(`
|
||||||
. . . . .
|
. . . . .
|
||||||
. # . # .
|
. # . # .
|
||||||
. . # . .
|
. . # . .
|
||||||
# ; . . #
|
# . . . #
|
||||||
. # # # .
|
. # # # .
|
||||||
`)
|
`)
|
||||||
```
|
```
|
||||||
|
@ -61,7 +61,7 @@ The [math library](/blocks/math) includes math related functions.
|
|||||||
For example, the `absolute` function returns the returns the absolute value of input parameter `x`:
|
For example, the `absolute` function returns the returns the absolute value of input parameter `x`:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
let abs = math.absolute(-42);
|
let abs = Math.abs(-42);
|
||||||
basic.showNumber(abs);
|
basic.showNumber(abs);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"bluetooth": "Support for additional Bluetooth services.",
|
||||||
|
"bluetooth.onBluetoothConnected": "Register code to run when the micro:bit is connected to over Bluetooth",
|
||||||
|
"bluetooth.onBluetoothConnected|block": "on bluetooth connected",
|
||||||
|
"bluetooth.onBluetoothConnected|param|body": "Code to run when a Bluetooth connection is established",
|
||||||
|
"bluetooth.onBluetoothDisconnected": "Register code to run when a bluetooth connection to the micro:bit is lost",
|
||||||
|
"bluetooth.onBluetoothDisconnected|block": "on bluetooth disconnected",
|
||||||
|
"bluetooth.onBluetoothDisconnected|param|body": "Code to run when a Bluetooth connection is lost",
|
||||||
|
"bluetooth.startAccelerometerService": "Starts the Bluetooth accelerometer service",
|
||||||
|
"bluetooth.startAccelerometerService|block": "bluetooth accelerometer service",
|
||||||
|
"bluetooth.startButtonService": "Starts the Bluetooth button service",
|
||||||
|
"bluetooth.startButtonService|block": "bluetooth button service",
|
||||||
|
"bluetooth.startIOPinService": "Starts the Bluetooth IO pin service.",
|
||||||
|
"bluetooth.startIOPinService|block": "bluetooth io pin service",
|
||||||
|
"bluetooth.startLEDService": "Starts the Bluetooth LED service",
|
||||||
|
"bluetooth.startLEDService|block": "bluetooth led service",
|
||||||
|
"bluetooth.startMagnetometerService": "Starts the Bluetooth magnetometer service",
|
||||||
|
"bluetooth.startMagnetometerService|block": "bluetooth magnetometer service",
|
||||||
|
"bluetooth.startTemperatureService": "Starts the Bluetooth temperature service",
|
||||||
|
"bluetooth.startTemperatureService|block": "bluetooth temperature service",
|
||||||
|
"bluetooth.uartRead": "Reads from the Bluetooth UART service buffer, returning its contents when the specified delimiter character is encountered.",
|
||||||
|
"bluetooth.uartRead|block": "bluetooth uart read %del=bluetooth_uart_delimiter_conv",
|
||||||
|
"bluetooth.uartWrite": "Writes to the Bluetooth UART service buffer. From there the data is transmitted over Bluetooth to a connected device.",
|
||||||
|
"bluetooth.uartWrite|block": "bluetooth uart write %data",
|
||||||
|
"bluetooth|block": "bluetooth"
|
||||||
|
}
|
26
libs/microbit-devices/_locales/microbit-devices-strings.json
Normal file
26
libs/microbit-devices/_locales/microbit-devices-strings.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"devices": "Control a phone with the BBC micro:bit via Bluetooth.",
|
||||||
|
"devices.onGamepadButton": "Register code to run when the micro:bit receives a command from the paired gamepad.",
|
||||||
|
"devices.onGamepadButton|block": "on gamepad button|%NAME",
|
||||||
|
"devices.onGamepadButton|param|body": "code to run when button is pressed",
|
||||||
|
"devices.onGamepadButton|param|name": "button name",
|
||||||
|
"devices.onNotified": "Registers code to run when the device notifies about a particular event.",
|
||||||
|
"devices.onNotified|block": "on notified|%event",
|
||||||
|
"devices.onNotified|param|body": "code handler when event is triggered",
|
||||||
|
"devices.onNotified|param|event": "event description",
|
||||||
|
"devices.onSignalStrengthChanged": "Registers code to run when the device notifies about a change of signal strength.",
|
||||||
|
"devices.onSignalStrengthChanged|block": "on signal strength changed",
|
||||||
|
"devices.onSignalStrengthChanged|param|body": "Code run when the signal strength changes.",
|
||||||
|
"devices.raiseAlertTo": "Sends an ``alert`` command to the parent device.",
|
||||||
|
"devices.raiseAlertTo|block": "raise alert to|%property",
|
||||||
|
"devices.raiseAlertTo|param|event": "event description",
|
||||||
|
"devices.signalStrength": "Returns the last signal strength reported by the paired device.",
|
||||||
|
"devices.signalStrength|block": "signal strength",
|
||||||
|
"devices.tellCameraTo": "Sends a ``camera`` command to the parent device.",
|
||||||
|
"devices.tellCameraTo|block": "tell camera to|%property",
|
||||||
|
"devices.tellCameraTo|param|event": "event description",
|
||||||
|
"devices.tellRemoteControlTo": "Sends a ``remote control`` command to the parent device.",
|
||||||
|
"devices.tellRemoteControlTo|block": "tell remote control to|%property",
|
||||||
|
"devices.tellRemoteControlTo|param|event": "event description",
|
||||||
|
"devices|block": "devices"
|
||||||
|
}
|
@ -92,7 +92,7 @@
|
|||||||
"input.onShake": "Attaches code to run when the device is shaken.",
|
"input.onShake": "Attaches code to run when the device is shaken.",
|
||||||
"input.onShake|param|body": "TODO",
|
"input.onShake|param|body": "TODO",
|
||||||
"input.pinIsPressed": "Get the pin state (pressed or not). Requires to hold the ground to close the circuit.",
|
"input.pinIsPressed": "Get the pin state (pressed or not). Requires to hold the ground to close the circuit.",
|
||||||
"input.pinIsPressed|block": "pin|%NAME|is pressed",
|
"input.pinIsPressed|block": "pin %NAME|is pressed",
|
||||||
"input.pinIsPressed|param|name": "pin used to detect the touch",
|
"input.pinIsPressed|param|name": "pin used to detect the touch",
|
||||||
"input.rotation": "The pitch of the device, rotation along the ``x-axis``, in degrees.",
|
"input.rotation": "The pitch of the device, rotation along the ``x-axis``, in degrees.",
|
||||||
"input.rotation|block": "rotation (°)|%NAME",
|
"input.rotation|block": "rotation (°)|%NAME",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-microbit",
|
"name": "pxt-microbit",
|
||||||
"version": "0.3.2",
|
"version": "0.3.3",
|
||||||
"description": "BBC micro:bit target for PXT",
|
"description": "BBC micro:bit target for PXT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@ -29,6 +29,6 @@
|
|||||||
"typescript": "^1.8.7"
|
"typescript": "^1.8.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-core": "0.3.2"
|
"pxt-core": "0.3.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user