Migrate docs from the other repo
This commit is contained in:
86
docs/reference/js/guides/basic-led-show.md
Normal file
86
docs/reference/js/guides/basic-led-show.md
Normal file
@ -0,0 +1,86 @@
|
||||
# basic LED show
|
||||
|
||||
#tutorial #docs
|
||||
|
||||
### Challenge 0
|
||||
|
||||
You have successfully following the [guided tutorial] (https://live.microbit.co.uk/td/tutorials/blink). If not, we should make sure the micro:bit script displays a blinking script on screen. We want to plot the x and y coordinates to 2, 2. Additionally, you will pause by 100 milliseconds then you will clear the screen of the micro:bit. Let's give it a go!
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led.plot(2, 2)
|
||||
basic.pause(200)
|
||||
basic.clearScreen()
|
||||
basic.pause(200)
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Challenge 1
|
||||
|
||||
Use `basic->show string` to display text after the blink. You will be writing a series of letters to display a series of letters. Try to unravel this secret code word: HELP. This line of code is within the while scope
|
||||
|
||||
Make sure to add this line of code within the `while` scope!
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led1.plot(2, 2)
|
||||
basic1.pause(200)
|
||||
basic1.clearScreen()
|
||||
basic1.pause(200)
|
||||
basic1.showString("HELP", 150) // ***
|
||||
}
|
||||
```
|
||||
|
||||
* run the code and see that it works as expected
|
||||
|
||||
### Challenge 2
|
||||
|
||||
You can also display a number on screen using `basic‐>show number`. Add code under `basic‐>show string` to display the emergency number to call in the United Kingdom. (NOTE: 999 is the historic emergency number for the United Kingdom. All calls are answered by 999 operators. Calls are always free.)
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led2.plot(2, 2)
|
||||
basic2.pause(200)
|
||||
basic2.clearScreen()
|
||||
basic2.pause(200)
|
||||
basic2.showString("HELP", 150)
|
||||
basic2.showNumber(999, 150) // ***
|
||||
}
|
||||
```
|
||||
|
||||
Awesome! You have designed your message and a number to call in case of an emergency.
|
||||
|
||||
### Challenge 3
|
||||
|
||||
* tap the `run` button to view the updated script on the simulator
|
||||
|
||||
Add an associated animation after the emergency number . You can also create a cool animation on screen using `basic->show animation`. Add code under `basic->show number` to display an animation.
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led3.plot(2, 2)
|
||||
basic3.pause(200)
|
||||
basic3.clearScreen()
|
||||
basic3.pause(200)
|
||||
basic3.showString("HELP", 150)
|
||||
basic3.showNumber(999, 150)
|
||||
basic3.showAnimation(`
|
||||
# # . # #
|
||||
. # . # .
|
||||
. . # . .
|
||||
# . . . #
|
||||
# # # # #
|
||||
`, 400) // ***
|
||||
}
|
||||
```
|
||||
|
||||
Awesome! We have implemented a string, number, and animation
|
||||
|
||||
* run the code and see that it works as expected.
|
||||
|
||||
### Challenge 4
|
||||
|
||||
Use the same logic `basic->string`, `basic->number`, or `basic->animation` to turn on the LEDs and display information!!!
|
||||
|
||||
* run the code and see that it works as expected
|
111
docs/reference/js/guides/blink-symbols.md
Normal file
111
docs/reference/js/guides/blink-symbols.md
Normal file
@ -0,0 +1,111 @@
|
||||
# blink symbols
|
||||
|
||||
#tutorial #docs
|
||||
|
||||
### Challenge 0
|
||||
|
||||
You have successfully following the [blink tutorial](/microbit/hcwxud). If not, then let's start the tutorial now. Your micro:bit script should start by displaying a blinking script on screen. We want to plot the x and y coordinates to 2, 2. Additionally, you will pause by 100 milliseconds then clear the screen of the micro:bit.
|
||||
|
||||
Let's give it a go!
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led.plot(2, 2)
|
||||
basic.pause(200)
|
||||
basic.clearScreen()
|
||||
basic.pause(200)
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Challenge 1
|
||||
|
||||
Make a `>` greater than symbol. Start in the upper left corner of the simulator when you plot coordinates. Make sure to add the line of code `led->plot (0,0)` under the last line of code
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led1.plot(2, 2)
|
||||
basic1.pause(200)
|
||||
basic1.clearScreen()
|
||||
basic1.pause(200)
|
||||
led1.plot(0, 0) // ***
|
||||
}
|
||||
```
|
||||
|
||||
Design the top half of the `>` symbol by connecting a LED to the original center coordinate `2,2` and the upper left coordinate `0,0` Make sure to add the line of code `led->plot (1,1)` under the last line of code
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led2.plot(2, 2)
|
||||
basic2.pause(200)
|
||||
basic2.clearScreen()
|
||||
basic2.pause(200)
|
||||
led2.plot(0, 0)
|
||||
led2.plot(1, 1) // ***
|
||||
}
|
||||
```
|
||||
|
||||
Awesome! You have designed half of the `>` symbol. Now we should finish the lower half of the `>` symbol
|
||||
|
||||
* tap the `run` button to view the updated script on the simulator
|
||||
|
||||
Add the bottom half of the `>` symbol by plotting the most bottom - left LED first. Make sure to add the line of code `led->plot (0,5)`
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led3.plot(2, 2)
|
||||
basic3.pause(200)
|
||||
basic3.clearScreen()
|
||||
basic3.pause(200)
|
||||
led3.plot(0, 0)
|
||||
led3.plot(1, 1)
|
||||
led3.plot(0, 4) // ***
|
||||
}
|
||||
```
|
||||
|
||||
Awesome! Now we must connect a LED to the original center coordinate `2,2` and the lower left coordinate `0,5` Make sure to add the line of code `led->plot (1,4)`
|
||||
|
||||
Your `main` function should look like this:
|
||||
|
||||
```
|
||||
while (true) {
|
||||
led4.plot(2, 2)
|
||||
basic4.pause(200)
|
||||
basic4.clearScreen()
|
||||
basic4.pause(200)
|
||||
led4.plot(0, 0)
|
||||
led4.plot(1, 1)
|
||||
led4.plot(0, 4)
|
||||
led4.plot(1, 3) // ***
|
||||
}
|
||||
```
|
||||
|
||||
* `run` the script and see that the program works as expected
|
||||
|
||||
Congratulations! You made a `>` symbol.
|
||||
|
||||
### Challenge 2
|
||||
|
||||
Use `led->plot` to create a exclamation design `!` Your `main` function should look like this. (notice the notation of `...` represents previous code in **Challenge 0** and **Challenge 1**
|
||||
|
||||
Make sure to add these lines of code within the `while` loop
|
||||
|
||||
Your `main` function should look like this:
|
||||
|
||||
```
|
||||
while (true) {
|
||||
// ...
|
||||
led5.plot(4, 0) // ***
|
||||
led5.plot(4, 1) // ***
|
||||
led5.plot(4, 2) // ***
|
||||
led5.plot(4, 4) // ***
|
||||
}
|
||||
```
|
||||
|
||||
* run the code and see that it works as expected.
|
||||
|
||||
### Challenge 3
|
||||
|
||||
Use the same logic `led->plot` to turn on all the LED lights!!!
|
||||
|
||||
* run the code and see that it works as expected
|
43
docs/reference/js/guides/light-column-cascade-activity.md
Normal file
43
docs/reference/js/guides/light-column-cascade-activity.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Light Column Cascade Worksheet
|
||||
|
||||
My script. #docs
|
||||
|
||||
**Challenge 0**
|
||||
|
||||
Great Job! You have completed the Light Column Cascade tutorial having a nested for loop that plots each individual LED by column adding a delay between lighting each LED.
|
||||
|
||||
```
|
||||
for (let i = 0; i < 5; i++) {
|
||||
for (let j = 0; j < 5; j++) {
|
||||
led.plot(i, j)
|
||||
basic.pause(200)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Challenge 1**
|
||||
|
||||
Make the board light up faster by making the pause less time.
|
||||
|
||||
```
|
||||
for (let i1 = 0; i1 < 5; i1++) {
|
||||
for (let j1 = 0; j1 < 5; j1++) {
|
||||
led1.plot(i1, j1)
|
||||
basic1.pause(100) // ***
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Challenge 2**
|
||||
|
||||
Make the board light up by rows instead of by columns by changing the i to the y position and j to the x position.
|
||||
|
||||
```
|
||||
for (let i2 = 0; i2 < 5; i2++) {
|
||||
for (let j2 = 0; j2 < 5; j2++) {
|
||||
led2.plot(j2, i2) // ***
|
||||
basic2.pause(100)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
43
docs/reference/js/guides/light-column-cascade.md
Normal file
43
docs/reference/js/guides/light-column-cascade.md
Normal file
@ -0,0 +1,43 @@
|
||||
# Light Column Cascade Activity
|
||||
|
||||
My script. #docs
|
||||
|
||||
**Challenge 0**
|
||||
|
||||
Great Job! You have completed the Light Column Cascade tutorial having a nested for loop that plots each individual LED by column adding a delay between lighting each LED.
|
||||
|
||||
```
|
||||
for (let i = 0; i < 5; i++) {
|
||||
for (let j = 0; j < 5; j++) {
|
||||
led.plot(i, j)
|
||||
basic.pause(200)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Challenge 1**
|
||||
|
||||
Make the board light up faster by making the pause less time.
|
||||
|
||||
```
|
||||
for (let i1 = 0; i1 < 5; i1++) {
|
||||
for (let j1 = 0; j1 < 5; j1++) {
|
||||
led1.plot(i1, j1)
|
||||
basic1.pause(100) // ***
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
**Challenge 2**
|
||||
|
||||
Make the board light up by rows instead of by columns by changing the i to the y position and j to the x position.
|
||||
|
||||
```
|
||||
for (let i2 = 0; i2 < 5; i2++) {
|
||||
for (let j2 = 0; j2 < 5; j2++) {
|
||||
led2.plot(j2, i2) // ***
|
||||
basic2.pause(100)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
22
docs/reference/js/guides/scroll-image-docs.md
Normal file
22
docs/reference/js/guides/scroll-image-docs.md
Normal file
@ -0,0 +1,22 @@
|
||||
# Scroll Image Docs
|
||||
|
||||
My script. #docs
|
||||
|
||||
**Challenge 0**
|
||||
|
||||
This [guided tutorial](/microbit/xuhkviyyxa) introduces how to make an image look like it's scrolling across the micro:bit!
|
||||
|
||||
We can use an animation to make an image look like its moving!
|
||||
|
||||
```
|
||||
basic.forever()
|
||||
```
|
||||
|
||||
**Challenge 1**
|
||||
|
||||
Now, let's reverse the animation so it looks like the bar is bouncing off the right edge of the display.
|
||||
|
||||
```
|
||||
basic1.forever()
|
||||
```
|
||||
|
140
docs/reference/js/guides/touchdevelop-lessons.md
Normal file
140
docs/reference/js/guides/touchdevelop-lessons.md
Normal file
@ -0,0 +1,140 @@
|
||||
# TouchDevelop Lessons
|
||||
|
||||
Overview of TouchDevelop lessons for the micro:bit. #docs #contents
|
||||
|
||||
### @section full
|
||||
|
||||
### ~column
|
||||
|
||||
### LED screen
|
||||
|
||||
* [plot guided](/microbit/hcwxud) `guided tutorial ` `video available`
|
||||
* [plots an LED](/microbit/njuzbvocit) [guided tutorial]
|
||||
* [blink symbols](/microbit/rfchtfjmag) `docs`
|
||||
* [clear screen](/microbit/jwqywu)
|
||||
* [point](/microbit/reference/led/point)
|
||||
* [set brightness](/microbit/tfrmcgdtxk)
|
||||
|
||||
## micro:bit
|
||||
|
||||
## functions
|
||||
|
||||
### Basic
|
||||
|
||||
* [show number](/microbit/doxhko)
|
||||
* [show string](/microbit/hgsfxg)
|
||||
* [forever - show image](/microbit/bniyze) `guided tutorial`
|
||||
* [forever - show animation - two frames 1a](/microbit/rwsjmubtaa)
|
||||
* [forever - show animation - two frames 1c](/microbit/fomtaxxdkk)
|
||||
* [forever - show animation - two frames 1 d](/microbit/huguhgjmmn)
|
||||
* [forever - show animation - multliple frames](/microbit/tweyhx)
|
||||
|
||||
## Language {#pconst}
|
||||
|
||||
### Variables
|
||||
|
||||
* [global variables ](/microbit/nkecii) `guided tutorial`
|
||||
* [local variable - create image, show image](/microbit/dcvnwv)
|
||||
* data types: [number](/microbit/reference/types/number), [boolean](/microbit/reference/types/boolean), [string](/microbit/reference/types/string), [image](/microbit/reference/image/image)
|
||||
|
||||
### Statements and control structures
|
||||
|
||||
* [if](/microbit/reference/logic/if)
|
||||
* [for](/microbit/reference/loops/for)
|
||||
* [for loop nested - plot](/microbit/vpvhdnaqfm) **script**
|
||||
* [while](/microbit/js/while)
|
||||
* [while - show string, show number, show animation](/microbit/bidtzqdips) `docs`
|
||||
* [while - create image ](/microbit/bnqbom)
|
||||
* [return](/microbit/js/return)
|
||||
* [break](/microbit/js/break)
|
||||
* [function](/microbit/js/function)
|
||||
* [assignment operation](/microbit/reference/variables/assign) `:=`
|
||||
|
||||
### Maths
|
||||
|
||||
* arithmetic operators (`+`, `-`, `*`, `/`, mod) on [numbers](/microbit/reference/types/number)
|
||||
* comparison operators (such as `>`, `=`) on [numbers](/microbit/reference/types/number)
|
||||
* the [math](/microbit/js/math) library
|
||||
* the [bits](/microbit/js/bits) library
|
||||
|
||||
### Logical
|
||||
|
||||
* boolean operators (`not`, `or`, `and`) on [booleans](/microbit/reference/types/boolean)
|
||||
|
||||
### Strings
|
||||
|
||||
* concat operator combines [strings](/microbit/reference/types/string)
|
||||
|
||||
### ~
|
||||
|
||||
### ~column
|
||||
|
||||
### Input
|
||||
|
||||
* [button is pressed](/microbit/reference/input/button-is-pressed)
|
||||
* [on button pressed](/microbit/reference/input/on-button-pressed)
|
||||
* [acceleration](/microbit/reference/input/acceleration)
|
||||
* [compass heading](/microbit/reference/input/compass-heading)
|
||||
* [calibrate](/microbit/functions/calibrate)
|
||||
* [running time](/microbit/reference/input/running-time)
|
||||
* [on shake](/microbit/reference/input/on-gesture)
|
||||
* [on screen up](/microbit/functions/on-screen-up)
|
||||
* [on screen down](/microbit/functions/on-screen-down)
|
||||
* [on logo up](/microbit/functions/on-logo-up)
|
||||
* [on logo down](/microbit/functions/on-logo-down)
|
||||
|
||||
### ~
|
||||
|
||||
### ~column
|
||||
|
||||
### Authoring & Other Bits
|
||||
|
||||
* [TouchDevelop editor](/microbit/js/editor)
|
||||
* [markdown](/microbit/js/markdown)
|
||||
* [creating interactive tutorials](/microbit/js/creatinginteractivetutorials)
|
||||
* [run scripts in a web browser](/microbit/js/simulator)
|
||||
* [run scripts on your micro:bit](/microbit/usb)
|
||||
* [libraries](/microbit/js/libraries)
|
||||
|
||||
### Functions and libraries
|
||||
|
||||
* [creating functions](/microbit/js/function)
|
||||
* [function parameters](/microbit/js/functionparameters)
|
||||
* [calling functions](/microbit/js/call)
|
||||
* [libraries](/microbit/js/libraries)
|
||||
|
||||
### Images
|
||||
|
||||
* [create image](/microbit/reference/images/create-image)
|
||||
* [clear](/microbit/reference/basic/clear-screen)
|
||||
* [set pixel](/microbit/reference/images/set-pixel)
|
||||
* [pixel](/microbit/reference/images/pixel)
|
||||
* [show image](/microbit/reference/images/show-image)
|
||||
* [scroll image](/microbit/reference/images/scroll-image)
|
||||
* [width](/microbit/functions/width)
|
||||
* [show animation](/microbit/reference/basic/show-animation)
|
||||
|
||||
### Pins
|
||||
|
||||
* [analog read pin](/microbit/reference/pins/analog-read-pin)
|
||||
* [analog write pin](/microbit/reference/pins/analog-write-pin)
|
||||
* [digital read pin](/microbit/reference/pins/digital-read-pin)
|
||||
* [digital write pin](/microbit/reference/pins/digital-write-pin)
|
||||
|
||||
### Accessories
|
||||
|
||||
* [forever](/microbit/reference/basic/forever)
|
||||
* [in background](/microbit/reference/control/in-background)
|
||||
|
||||
## Tutorials
|
||||
|
||||
* [Blink](/script:hcwxud)
|
||||
* [Button](/script:rxqgzy)
|
||||
* [Compass](/script:fhhhwl)
|
||||
* [Counter](/script:bqrria)
|
||||
* [Digital pet](/script:lsqwsk)
|
||||
* [Flashing heart](/script:bniyze)
|
||||
* [Glowing image](/script:hydyrp)
|
||||
|
||||
### ~
|
||||
|
Reference in New Issue
Block a user