support for multiple categories
This commit is contained in:
parent
37efefdcee
commit
282189d41b
@ -8,22 +8,26 @@ Here are some fun programs for your @boardname@!
|
|||||||
[{
|
[{
|
||||||
"name": "Blinky",
|
"name": "Blinky",
|
||||||
"description": "A blinking LED",
|
"description": "A blinking LED",
|
||||||
"url":"/examples/blinky"
|
"url":"/examples/blinky",
|
||||||
|
"cardType": "example"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Name Tag",
|
"name": "Name Tag",
|
||||||
"description": "Scroll your name on the screen",
|
"description": "Scroll your name on the screen",
|
||||||
"url":"/examples/name-tag"
|
"url":"/examples/name-tag",
|
||||||
|
"cardType": "example"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Rando",
|
"name": "Rando",
|
||||||
"description": "Randomly blinking LEDs",
|
"description": "Randomly blinking LEDs",
|
||||||
"url":"/examples/rando"
|
"url":"/examples/rando",
|
||||||
|
"cardType": "example"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Game of Life",
|
"name": "Game of Life",
|
||||||
"description": "Simulation in LEDs. Use button A for next stage. Button B for reset.",
|
"description": "Simulation in LEDs. Use button A for next stage. Button B for reset.",
|
||||||
"url":"/examples/gameofLife"
|
"url":"/examples/gameofLife",
|
||||||
|
"cardType": "example"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -34,15 +38,18 @@ Here are some fun programs for your @boardname@!
|
|||||||
[{
|
[{
|
||||||
"name": "Plot Acceleration",
|
"name": "Plot Acceleration",
|
||||||
"description": "chart acceleration on the LED screen",
|
"description": "chart acceleration on the LED screen",
|
||||||
"url":"/examples/plot-acceleration"
|
"url":"/examples/plot-acceleration",
|
||||||
|
"cardType": "example"
|
||||||
}, {
|
}, {
|
||||||
"name": "Plot Light Level",
|
"name": "Plot Light Level",
|
||||||
"description": "chart light level on the LED screen",
|
"description": "chart light level on the LED screen",
|
||||||
"url":"/examples/plot-light-level"
|
"url":"/examples/plot-light-level",
|
||||||
|
"cardType": "example"
|
||||||
}, {
|
}, {
|
||||||
"name": "Plot Analog Pin",
|
"name": "Plot Analog Pin",
|
||||||
"description": "chart analog input on the LED screen",
|
"description": "chart analog input on the LED screen",
|
||||||
"url":"/examples/plot-analog-pin"
|
"url":"/examples/plot-analog-pin",
|
||||||
|
"cardType": "example"
|
||||||
}]
|
}]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -52,7 +59,8 @@ Here are some fun programs for your @boardname@!
|
|||||||
[{
|
[{
|
||||||
"name": "Servo Calibrator",
|
"name": "Servo Calibrator",
|
||||||
"description": "calibrates a servo",
|
"description": "calibrates a servo",
|
||||||
"url":"/examples/servo-calibrator"
|
"url":"/examples/servo-calibrator",
|
||||||
|
"cardType": "example"
|
||||||
}]
|
}]
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -62,6 +70,7 @@ Here are some fun programs for your @boardname@!
|
|||||||
[{
|
[{
|
||||||
"name": "Eddystone Beacon",
|
"name": "Eddystone Beacon",
|
||||||
"description": "Beacon that beams a URL",
|
"description": "Beacon that beams a URL",
|
||||||
"url": "/examples/eddystone-beacon"
|
"url": "/examples/eddystone-beacon",
|
||||||
|
"cardType": "example"
|
||||||
}]
|
}]
|
||||||
```
|
```
|
@ -10,7 +10,8 @@ Fun games to build with your @boardname@.
|
|||||||
[{
|
[{
|
||||||
"name": "Flashing Heart",
|
"name": "Flashing Heart",
|
||||||
"url":"/projects/flashing-heart",
|
"url":"/projects/flashing-heart",
|
||||||
"imageUrl": "/static/mb/projects/a1-display.png"
|
"imageUrl": "/static/mb/projects/a1-display.png",
|
||||||
|
"cardType": "tutorial"
|
||||||
},{
|
},{
|
||||||
"name": "Smiley Buttons",
|
"name": "Smiley Buttons",
|
||||||
"url":"/projects/smiley-buttons",
|
"url":"/projects/smiley-buttons",
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
# flashing heart
|
# Flashing Heart
|
||||||
|
|
||||||
### ~avatar avatar
|
|
||||||
|
|
||||||
Use the LEDs to display a flashing heart!
|
|
||||||
|
|
||||||
### ~
|
|
||||||
|
|
||||||
## Step 1
|
## Step 1
|
||||||
|
|
||||||
Use [show leds](/reference/basic/show-leds) and make your code look like this:
|
Place the ``||show leds||`` block and paint a heart.
|
||||||
|
|
||||||
```blocks
|
```block
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. # . # .
|
. # . # .
|
||||||
# # # # #
|
# # # # #
|
||||||
@ -22,42 +16,33 @@ basic.showLeds(`
|
|||||||
|
|
||||||
## Step 2
|
## Step 2
|
||||||
|
|
||||||
Add a [pause](/reference/basic/pause) to wait and [clear screen](/reference/basic/clear-screen) to turn off the LEDs.
|
Click ``|Download|`` to transfer your code in your @boardname@!
|
||||||
|
|
||||||
```blocks
|
## Step 3
|
||||||
|
|
||||||
|
Place another ``||show leds||`` block under the heart to make it blink.
|
||||||
|
|
||||||
|
```block
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. # . # .
|
. # . # .
|
||||||
# # # # #
|
# # # # #
|
||||||
# # # # #
|
# # # # #
|
||||||
. # # # .
|
. # # # .
|
||||||
. . # . .`);
|
. . # . .`);
|
||||||
basic.pause(500);
|
basic.showLeds(`
|
||||||
basic.clearScreen();
|
|
||||||
```
|
|
||||||
|
|
||||||
## Step 3
|
|
||||||
|
|
||||||
Put a [forever loop](/reference/basic/forever) around it to repeat the animation.
|
|
||||||
|
|
||||||
```blocks
|
|
||||||
basic.forever(() => {
|
|
||||||
basic.showLeds(`
|
|
||||||
. # . # .
|
. # . # .
|
||||||
# # # # #
|
# . # . #
|
||||||
# # # # #
|
# . . . #
|
||||||
. # # # .
|
. # . # .
|
||||||
. . # . .`
|
. . # . .`);
|
||||||
);
|
|
||||||
basic.pause(500);
|
|
||||||
basic.clearScreen();
|
|
||||||
})
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Step 4
|
## Step 4
|
||||||
|
|
||||||
Add a [pause](/reference/basic/pause) to wait after clearing the screen.
|
Place the blocks inside the ``||forever||``
|
||||||
|
to repeat the animation.
|
||||||
|
|
||||||
```blocks
|
```block
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. # . # .
|
. # . # .
|
||||||
@ -66,43 +51,47 @@ basic.forever(() => {
|
|||||||
. # # # .
|
. # # # .
|
||||||
. . # . .`
|
. . # . .`
|
||||||
);
|
);
|
||||||
basic.pause(500);
|
basic.showLeds(`
|
||||||
basic.clearScreen();
|
. # . # .
|
||||||
basic.pause(500);
|
# . # . #
|
||||||
|
# . . . #
|
||||||
|
. # . # .
|
||||||
|
. . # . .`);
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
## Send your heartbeats over radio!
|
## Step 5
|
||||||
|
|
||||||
Do you have a second @boardname@ at hand? You could use radio and send your heartbeats to other
|
Click ``|Download|`` to transfer your code in your @boardname@!
|
||||||
@boardname@ and show a heart when you receive one.
|
|
||||||
|
|
||||||
* move the code in the **forever** inside
|
## Step 6
|
||||||
a [on data packet received](/reference/radio/on-data-packet-received) handler.
|
|
||||||
The handler will run whenever a message is received from another @boardname@.
|
|
||||||
* use [send number](/reference/radio/send-number) and [pause](/reference/basic/pause)
|
|
||||||
to broadcast a packet of data every second.
|
|
||||||
|
|
||||||
```blocks
|
Place more ``||show leds||`` blocks to create your own animation.
|
||||||
|
|
||||||
|
```block
|
||||||
basic.forever(() => {
|
basic.forever(() => {
|
||||||
radio.sendNumber(0)
|
|
||||||
basic.pause(1000)
|
|
||||||
})
|
|
||||||
radio.onDataPacketReceived(({receivedNumber}) => {
|
|
||||||
basic.showLeds(`
|
basic.showLeds(`
|
||||||
. # . # .
|
. # . # .
|
||||||
# # # # #
|
# # # # #
|
||||||
# # # # #
|
# # # # #
|
||||||
. # # # .
|
. # # # .
|
||||||
|
. . # . .`
|
||||||
|
);
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
# . # . #
|
||||||
|
# . . . #
|
||||||
|
. # . # .
|
||||||
. . # . .`);
|
. . # . .`);
|
||||||
basic.pause(500)
|
basic.showLeds(`
|
||||||
basic.clearScreen()
|
. . . . .
|
||||||
basic.pause(500)
|
. # . # .
|
||||||
|
. # # # .
|
||||||
|
. . # . .
|
||||||
|
. . . . .`);
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
Download the .hex file onto both @boardname@ and try it out!
|
## Step 7
|
||||||
|
|
||||||
```package
|
Click ``|Download|`` to transfer your code in your @boardname@!
|
||||||
radio
|
|
||||||
```
|
|
||||||
|
@ -213,6 +213,10 @@
|
|||||||
"privacyUrl": "https://makecode.com/privacy",
|
"privacyUrl": "https://makecode.com/privacy",
|
||||||
"termsOfUseUrl": "https://makecode.com/termsofuse",
|
"termsOfUseUrl": "https://makecode.com/termsofuse",
|
||||||
"githubUrl": "https://github.com/Microsoft/pxt-microbit",
|
"githubUrl": "https://github.com/Microsoft/pxt-microbit",
|
||||||
|
"galleries": {
|
||||||
|
"Projects": "projects",
|
||||||
|
"Examples": "examples"
|
||||||
|
},
|
||||||
"projectGallery": "projects",
|
"projectGallery": "projects",
|
||||||
"exampleGallery": "examples",
|
"exampleGallery": "examples",
|
||||||
"crowdinProject": "kindscript",
|
"crowdinProject": "kindscript",
|
||||||
|
Loading…
Reference in New Issue
Block a user