Migrate docs from the other repo
This commit is contained in:
55
docs/reference/js/lessons/blink/activity.md
Normal file
55
docs/reference/js/lessons/blink/activity.md
Normal file
@ -0,0 +1,55 @@
|
||||
# blink activity
|
||||
|
||||
Turn an LED on and off with forever
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
### @video td/videos/blink-0
|
||||
|
||||
Let's learn how to blink an LED.
|
||||
|
||||
### ~
|
||||
|
||||
Have you ever tried to blink a flashlight at night? The concept is fairly simply: turn on the light, wait for a little, turn off the light, wait again, and repeat. That's exactly what we need to code to get a blinking LED.
|
||||
|
||||
Let's start by adding a line of code that turns on the LED at position ``2, 2``.
|
||||
|
||||
```
|
||||
led.plot(2, 2)
|
||||
```
|
||||
|
||||
Run your script to make sure it's correct. Then, let's add code to **pause** `500` milliseconds and turn off the LED.
|
||||
|
||||
```
|
||||
led.plot(2, 2)
|
||||
basic.pause(500)
|
||||
led.unplot(2, 2)
|
||||
```
|
||||
|
||||
We've got the LED blinking once. Let's add another pause and turn on the LED again.
|
||||
|
||||
```
|
||||
led.plot(2, 2)
|
||||
basic.pause(500)
|
||||
led.unplot(2, 2)
|
||||
basic.pause(500)
|
||||
led.plot(2, 2)
|
||||
```
|
||||
|
||||
The current code works but it only blinks once! We are going to use a `basic->forever` loop and move the code inside it to repeat it forever. We've dropped the second `led-plot` line since we don't need it in the loop.
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
led.plot(2, 2)
|
||||
basic.pause(500)
|
||||
led.unplot(2, 2)
|
||||
basic.pause(500)
|
||||
})
|
||||
```
|
||||
|
||||
### ~avatar boothing
|
||||
|
||||
Excellent, you're ready to continue with the [challenges](/microbit/lessons/blink/challenges)!
|
||||
|
||||
### ~
|
||||
|
85
docs/reference/js/lessons/blink/challenges.md
Normal file
85
docs/reference/js/lessons/blink/challenges.md
Normal file
@ -0,0 +1,85 @@
|
||||
# blink challenges
|
||||
|
||||
Coding challenges for the blink tutorial #docs #challenges
|
||||
|
||||
## Before we get started
|
||||
|
||||
Complete the [blink](/microbit/lessons/blink/activity) activity and your code will look like this:
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
led.plot(2, 2)
|
||||
basic.pause(200)
|
||||
led.unplot(2, 2)
|
||||
basic.pause(200)
|
||||
})
|
||||
```
|
||||
|
||||
### Challenge 1
|
||||
|
||||
### @video td/videos/blink-1
|
||||
|
||||
Let's display a "smiley face" on the screen! We'll start by plotting the eyes.
|
||||
|
||||
Add `led->plot (1,1)` and `led->plot(3,1)` under `led->plot(2,2)` ; then add `led->unplot(1,1)` and `led->unplot(3,1)` after pause. When you're ready, don't forget to run your code to try it out!
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
led.plot(2, 2)
|
||||
led.plot(1, 1)
|
||||
led.plot(3, 1)
|
||||
basic.pause(200)
|
||||
led.unplot(2, 2)
|
||||
led.unplot(1, 1)
|
||||
led.unplot(3, 1)
|
||||
basic.pause(200)
|
||||
})
|
||||
```
|
||||
|
||||
### Challenge 2
|
||||
|
||||
### @video td/videos/blink-2
|
||||
|
||||
Let's add the code to plot the mouth by plotting and unplotting `(1,4)`, `(2,4)` and `(3,4)`.
|
||||
|
||||
```
|
||||
basic.forever(() => {
|
||||
led.plot(2, 2)
|
||||
led.plot(1, 1)
|
||||
led.plot(3, 1)
|
||||
led.plot(1, 4)
|
||||
led.plot(2, 4)
|
||||
led.plot(3, 4)
|
||||
basic.pause(200)
|
||||
led.unplot(2, 2)
|
||||
led.unplot(1, 1)
|
||||
led.unplot(3, 1)
|
||||
led.unplot(1, 4)
|
||||
led.unplot(2, 4)
|
||||
led.unplot(3, 4)
|
||||
basic.pause(200)
|
||||
})
|
||||
```
|
||||
|
||||
### Challenge 3
|
||||
|
||||
### @video td/videos/blink-3
|
||||
|
||||
Let's keep using `led->plot` to convert the mouth into a smiley face.
|
||||
|
||||
```` bitmatrix
|
||||
0 0 0 0 0
|
||||
0 1 0 1 0
|
||||
0 0 1 0 0
|
||||
1 0 0 0 1
|
||||
0 1 1 1 0
|
||||
````
|
||||
|
||||
### Challenge 4
|
||||
|
||||
Let's make it blink a bit faster. To do so, we need to reduce the amount of time used in ``basic->pause`` to ``100`` milliseconds.
|
||||
|
||||
### Challenge 5
|
||||
|
||||
Create your own image by changing the coordinates in `led->plot`!
|
||||
|
101
docs/reference/js/lessons/blink/lesson-plan.md
Normal file
101
docs/reference/js/lessons/blink/lesson-plan.md
Normal file
@ -0,0 +1,101 @@
|
||||
# blink lesson plan
|
||||
|
||||
Learn how to create a blinking LED script.
|
||||
|
||||
### @video vimeo/133778417
|
||||
|
||||
## Topic
|
||||
|
||||
Plot - Blinking LED
|
||||
|
||||
## Quick links
|
||||
|
||||
* [tutorial](/microbit/lessons/blink/tutorial)
|
||||
* [quiz](/microbit/js/blink/quiz)
|
||||
* [quiz answers](/microbit/lessons/blink/quiz-answers)
|
||||
* [challenges](/microbit/lessons/blink/challenges)
|
||||
|
||||
## Class
|
||||
|
||||
Year 7
|
||||
|
||||
## Prior learning/place of lesson in scheme of work
|
||||
|
||||
Learn how to control a blinking LED. We will be learning how to create a blinking app using forever as well as simple commands, such as plot, pause, and clear screen.
|
||||
|
||||
## What the teacher needs to know
|
||||
|
||||
**Program:** A stored set of instructions encoded in a language understood by the computer that does some form of computation, processing input and/or stored data to generate output.**
|
||||
|
||||
**Algorithm:** An unambiguous set of rules or a precise step-by-step guide to solve a problem or achieve a particular objective. The guided tutorial follows a algorithm and is a precise step-by-step guide to solve a problem**
|
||||
|
||||
**Loop:** A block of code repeated automatically under the program’s control. ** The blink program introduces Forever. Forever will repeats code in the background forever.
|
||||
|
||||
**Command:** An instruction for the computer to execute, written in a particular programming language.**
|
||||
|
||||
**QuickStart Computing Glossary
|
||||
|
||||
## Documentation
|
||||
|
||||
* **plot**: [read more...](/microbit/reference/led/plot)
|
||||
* **pause**: [read more...](/microbit/reference/basic/pause)
|
||||
* **clear screen**: [read more...](/microbit/reference/basic/clear-screen)
|
||||
* **forever**: [read more...](/microbit/reference/basic/forever)
|
||||
|
||||
## Resources
|
||||
|
||||
* Activity: [tutorial](/microbit/lessons/blink/tutorial)
|
||||
* Activity: [quiz](/microbit/lessons/blink/quiz)
|
||||
* Extended Activity: [challenges](/microbit/lessons/blink/challenges)
|
||||
|
||||
## Objectives
|
||||
|
||||
* learn how to blink a light
|
||||
* learn how to turn the light on and off
|
||||
* learn how to repeat turning on and off the light
|
||||
|
||||
## Links to the National Curriculum Programmes of Study for Computing
|
||||
|
||||
## Progression Pathways / Computational Thinking Framework
|
||||
|
||||
#### Algorithms
|
||||
|
||||
* Understands that iteration is the repetition of a process such as a loop. (AL)
|
||||
|
||||
#### Programming & Development
|
||||
|
||||
* Creates programs that implement algorithms to achieve given goals. (AL)
|
||||
|
||||
#### Data & Data Representation
|
||||
|
||||
* Understands the difference between data and information. (AB)
|
||||
* Defines data types: real numbers and Boolean. (AB)
|
||||
|
||||
#### Information Technology
|
||||
|
||||
* Collects, organises and presents data and information in digital content. (AB)
|
||||
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution. (EV)
|
||||
|
||||
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
|
||||
|
||||
## Activity
|
||||
|
||||
* time: 20 min.
|
||||
* [tutorial](/microbit/lessons/blink/tutorial)
|
||||
* [quiz](/microbit/lessons/blink/quiz)
|
||||
* assessment opportunities: forever, plot, pause, clear screen
|
||||
|
||||
## Extended Activity
|
||||
|
||||
* time: 20 min.
|
||||
* [challenges](/microbit/lessons/blink/challenges)
|
||||
* assessment opportunities: loops, plot, pause, clear screen
|
||||
|
||||
## Homework
|
||||
|
||||
* Extended Activity: [challenges](/microbit/lessons/blink/challenges)
|
||||
|
||||
## Intended follow on
|
||||
|
||||
Publish script to the classroom.
|
||||
|
46
docs/reference/js/lessons/blink/quiz-answers.md
Normal file
46
docs/reference/js/lessons/blink/quiz-answers.md
Normal file
@ -0,0 +1,46 @@
|
||||
# blink quiz answers
|
||||
|
||||
Learn how to create a blinking LED script.
|
||||
|
||||
This is the answer key for the [blink quiz](/microbit/lessons/blink/quiz).
|
||||
|
||||
## 1. Describe what `led->plot` does?
|
||||
|
||||
Answers will vary. In general, plot refers to the code that turns on a specific LED. We specify the LED using x, y coordinates.
|
||||
|
||||
## 2. Draw which LED is ON after running this code
|
||||
|
||||
```
|
||||
led.plot(2, 2)
|
||||
```
|
||||
|
||||

|
||||
|
||||
By default, the position of an LED on *Blink Tutorial* is set to the centre of the screen. This code turns on the centre LED
|
||||
|
||||
## 3. Draw which LED is ON after running this code
|
||||
|
||||
```
|
||||
led.plot(0, 0)
|
||||
```
|
||||
|
||||

|
||||
|
||||
This code turns on specific LED. Plot turns on the specified LED on the LED screen. We specify the LED using x, y coordinates.
|
||||
|
||||
* ``x`` - the x coordinate or horizontal position (0)
|
||||
* ``y`` - the y coordinate or vertical position (0)
|
||||
|
||||
## 4. Draw which LED is ON after running this code
|
||||
|
||||
```
|
||||
led.plot(4, 4)
|
||||
```
|
||||
|
||||

|
||||
|
||||
This code turns on specific LED. Plot turns on the specified LED on the LED screen. We specify the LED using ``x``, ``y`` coordinates.
|
||||
|
||||
* ``x`` - the x coordinate or horizontal position (4)
|
||||
* ``y`` - the y coordinate or vertical position (4)
|
||||
|
40
docs/reference/js/lessons/blink/quiz.md
Normal file
40
docs/reference/js/lessons/blink/quiz.md
Normal file
@ -0,0 +1,40 @@
|
||||
# blink quiz
|
||||
|
||||
Learn how to create a blinking LED script.
|
||||
|
||||
## Name
|
||||
|
||||
## Directions
|
||||
|
||||
Use this activity document to guide your work in the [blink tutorial](/microbit/lessons/blink/tutorial).
|
||||
|
||||
Answer the questions while completing the tutorial. Pay attention to the dialogues!
|
||||
|
||||
## 1. Describe what `led->plot` does?
|
||||
|
||||
<br/>
|
||||
|
||||
## 2. Draw which LED is ON after running this code
|
||||
|
||||
```
|
||||
led.plot(2, 2)
|
||||
```
|
||||
|
||||

|
||||
|
||||
## 3. Draw which LED is ON after running this code
|
||||
|
||||
```
|
||||
led.plot(0, 0)
|
||||
```
|
||||
|
||||

|
||||
|
||||
## 4. Draw which LED is ON after running this code
|
||||
|
||||
```
|
||||
led.plot(4, 4)
|
||||
```
|
||||
|
||||

|
||||
|
Reference in New Issue
Block a user