Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43456e9a53 | ||
|
|
081244218f | ||
|
|
6ae39f192b | ||
|
|
ed5263f248 | ||
|
|
f1ee861eb4 | ||
|
|
2ce2fd95ba | ||
|
|
741f94ce6c | ||
|
|
4b7e415ae7 | ||
|
|
3efbb4fbde | ||
|
|
4d9450dd06 | ||
|
|
910870e46f | ||
|
|
b664df4208 | ||
|
|
c660277a23 | ||
|
|
0416d88d59 | ||
|
|
4f822e3cda | ||
|
|
20d4e473ff | ||
|
|
e45190922e | ||
|
|
1df118fa19 |
@@ -13,6 +13,7 @@ PXT ([Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt
|
|||||||
|
|
||||||
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
|
||||||
* install the PXT command line
|
* install the PXT command line
|
||||||
```
|
```
|
||||||
npm install -g pxt
|
npm install -g pxt
|
||||||
|
|||||||
@@ -11,8 +11,9 @@ to make real programs that work!
|
|||||||
|
|
||||||
### Happy face
|
### Happy face
|
||||||
|
|
||||||
There are three blocks in the editor (the area to the left).
|
Use the **Basic** drawer in the editor (to the left)
|
||||||
Arrange them to look like this:
|
to drag out and arrange three blocks (two `show leds` and one `forever` block)
|
||||||
|
to create this program:
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
@@ -33,7 +34,7 @@ basic.forever(() => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
When you run this program, you will see a smiley face, then a blank
|
When you run this program (click the **Play** button) you will see a smiley face, then a blank
|
||||||
screen, then a smiley again -- it never stops! (That's because of the
|
screen, then a smiley again -- it never stops! (That's because of the
|
||||||
``forever`` block.)
|
``forever`` block.)
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ Click **Compile** to move your program to the BBC micro:bit!
|
|||||||
|
|
||||||
### Your turn!
|
### Your turn!
|
||||||
|
|
||||||
Pile up more ``show leds`` blocks to create your animation! Create an
|
Pile up more ``show leds`` blocks to create an animation! Create an
|
||||||
animation with at least 5 pictures. What does this animation show?
|
animation with at least 5 pictures. What does this animation show?
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
@@ -496,7 +497,7 @@ input.onButtonPressed(Button.B, () => {
|
|||||||
```
|
```
|
||||||
Click **Compile** to move your program to the BBC micro:bit!
|
Click **Compile** to move your program to the BBC micro:bit!
|
||||||
|
|
||||||
## Your turn!
|
|
||||||
|
|
||||||
How else can you make your game better?
|
# Want to do more?
|
||||||
Ever hear of [Rock Paper Scissors Spock Lizard](http://www.samkass.com/theories/RPSSL.html)?
|
|
||||||
|
There are [10 great projects](/projects) waiting for you.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Micro:bit APIs
|
# Reference
|
||||||
|
|
||||||
```namespaces
|
```namespaces
|
||||||
basic.showNumber(0);
|
basic.showNumber(0);
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ Turn off all the LED lights on the [LED screen](/device/screen).
|
|||||||
basic.clearScreen()
|
basic.clearScreen()
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example: vanishing heart
|
### Example: Vanishing heart
|
||||||
|
|
||||||
The following code shows a heart on the screen and then turns off all the LED lights using `clear screen`:
|
The following code shows a heart on the screen and then turns off all the LED lights.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
@@ -23,5 +23,5 @@ basic.clearScreen()
|
|||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[set brightness](/reference/led/set-brightness), [unplot](/reference/led/unplot), [plot](/reference/led/plot), [Image](/reference/images/image), [clear](/reference/basic/clear-screen)
|
[set brightness](/reference/led/set-brightness), [unplot](/reference/led/unplot), [plot](/reference/led/plot), [Image](/reference/images/image)
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# Send Number
|
# Send Value
|
||||||
|
|
||||||
Broadcast a (name,number) pair to other micro:bits connected via ``radio``.
|
Send a [string]() and [number]() together by ``radio`` to other micro:bits.
|
||||||
|
|
||||||
### Parameters
|
### Parameters
|
||||||
|
|
||||||
* name - a string to send
|
* a [string](/reference/types/string) to send by radio
|
||||||
* num - a number to send.
|
* a [number](/reference/types/number) to send by radio
|
||||||
|
|
||||||
### Simulator
|
### Simulator
|
||||||
|
|
||||||
@@ -13,16 +13,29 @@ This function only works on the micro:bit, not in browsers.
|
|||||||
|
|
||||||
### Example: Broadcasting acceleration
|
### Example: Broadcasting acceleration
|
||||||
|
|
||||||
This example broadcasts the value of your micro:bit's ``acceleration`` in the `x` direction
|
This program sends your micro:bit's **acceleration** (amount it is
|
||||||
(left and right) to other micro:bits.
|
speeding up or slowing down) in the `x` direction (left and right) to
|
||||||
This kind of program might be useful in a model car or model rocket.
|
other micro:bits. This kind of program might be useful in a model car
|
||||||
|
or model rocket.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
|
radio.setGroup(99)
|
||||||
input.onButtonPressed(Button.A, () => {
|
input.onButtonPressed(Button.A, () => {
|
||||||
radio.sendValue("acc",input.acceleration(Dimension.X))
|
radio.sendValue("acc",input.acceleration(Dimension.X))
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This program receives the string and number sent by the last program.
|
||||||
|
Then it shows them on the LED screen.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
radio.setGroup(99)
|
||||||
|
radio.onDataReceived(() => {
|
||||||
|
basic.showString(radio.receiveString());
|
||||||
|
basic.showNumber(radio.receiveNumber());
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
### See also
|
### See also
|
||||||
|
|
||||||
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
|
[receive number](/reference/radio/receive-number), [on data received](/reference/radio/on-data-received)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-microbit",
|
"name": "pxt-microbit",
|
||||||
"version": "0.2.166",
|
"version": "0.2.170",
|
||||||
"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.2.179"
|
"pxt-core": "0.2.182"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user