This commit is contained in:
Peli de Halleux 2016-04-13 09:17:25 -07:00
Родитель ac90b16825
Коммит 12dbdf8530
103 изменённых файлов: 0 добавлений и 7710 удалений

Просмотреть файл

@ -1,81 +0,0 @@
# answering machine lesson
create an answering machine on the BBC micro:bit #docs
### @video td/videos/answering-machine-0
## Topic
Show String
## Quick Links
* [activity](/lessons/answering-machine/activity)
* [quiz](/lessons/answering-machine/quiz)
* [quiz answers](/lessons/answering-machine/quiz-answers)
* [challenges](/lessons/answering-machine/challenges)
* [tutorial](/lessons/answering-machine/tutorial)
## Class
Year 7
## Prior learning / place of lesson in scheme of work
Learn how to creating a message with a **string**, `basic->show string` to write your message. We will be learning how to create a message using simple commands, such as show string and on button pressed.
## Documentation
* **show string** : [read more...](/reference/basic/show-string)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
## Objectives
* learn how to show a string on the LED screen one character at a time
* learn how to use to register an event handler that will execute whenever an input button is pressed
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns (AL)
#### Information Technology
* Collects, organizes, 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)
* Uses criteria to evaluate the quality of solutions, can identify improvements making some refinements to the solution, and future solutions (EV)
* Evaluates the appropriatness of digital devices, internet services and application software to achieve given goals (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/answering-machine/activity)
* [quiz](/lessons/answering-machine/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/answering-machine/challenges)
## Homework
* Extended Activity: [challenges](/lessons/answering-machine/challenges)

Просмотреть файл

@ -1,25 +0,0 @@
# banana keyboard blocks lesson
display beautiful images on the BBC micro:bit.
## Topic
Music
## Quick Links
* [activity](/lessons/banana-keyboard/activity)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to convert your BBC micro:bit into a music player using pins P0 and GND, earphones (or speakers), as well as crocodile clips (or spring clips). The connect fruit using pins P1 and GND.
## Objectives
* learn how to setup the BBC micro:bit with earphones to play music
* learn how to setup the BBC micro:bit with fruit be the musical instrument

Просмотреть файл

@ -1,76 +0,0 @@
# beautiful image lesson
display beautiful images on the BBC micro:bit.
### @video td/videos/beautiful-image-0
## Topic
Show LEDs
## Quick Links
* [activity](/lessons/beautiful-image/activity)
* [quiz](/lessons/beautiful-image/quiz)
* [quiz answers](/lessons/beautiful-image/quiz-answers)
* [challenges](/lessons/beautiful-image/challenges)
* [tutorial](/lessons/beautiful-image/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to **show LEDs**, to show an image on the BBC micro:bit's LED screen. We will be learning how to Show LEDs using simple commands such as Show LEDs and pause.
## Documentation
* **show LEDs** : [read more...](/reference/basic/show-leds)
* **pause** : [read more...](/reference/basic/pause)
## Objectives
* learn how to display an image on the micro:bit's LED screen
* learn how to pause your code for the specified number of milliseconds
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Selects the appropriate data types(AL) (AB
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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](/lessons/beautiful-image/tutorial)
* [quiz](/lessons/beautiful-image/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/beautiful-image/challenges)
## Homework
* Extended Activity: [challenges](/lessons/beautiful-image/challenges)

Просмотреть файл

@ -1,97 +0,0 @@
# blink lesson
Learn how to create a blinking LED.
### @video td/videos/blink-0
## Topic
Plot
## Quick links
* [activity](/lessons/blink/activity)
* [quiz](/lessons/blink/quiz)
* [quiz answers](/lessons/blink/quiz-answers)
* [challenges](/lessons/blink/challenges)
* [tutorial](/lessons/blink/tutorial)
## 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, unplot and pause.
## What the teacher needs to know / QuickStart Computing Glossary
**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 programs control. ** The blink program introduces Forever. The forever loop repeats code in the background forever.
**Command:** An instruction for the computer to execute, written in a particular programming language.
## Documentation
* **plot**: [read more...](/reference/led/plot)
* **unplot**: [read more...](/reference/led/unplot)
* **pause**: [read more...](/reference/basic/pause)
* **forever**: [read more...](/reference/basic/forever)
## Resources
* Activity: [tutorial](/lessons/blink/tutorial)
* Activity: [quiz](/lessons/blink/quiz)
* Extended Activity: [challenges](/lessons/blink/challenges)
## Objectives
* learn how to turn on LED lights on the LED screen
* learn how to turn off LED lights on the LED screen
* learn how to pause program execution for the specified number of milliseconds
## 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](/lessons/blink/tutorial)
* [quiz](/lessons/blink/quiz)
* [quiz answers](/lessons/blink/quiz-answers)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/blink/challenges)
## Homework
* Extended Activity: [challenges](/lessons/blink/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,55 +0,0 @@
# 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](/lessons/blink/challenges)!
### ~

Просмотреть файл

@ -1,85 +0,0 @@
# blink challenges
Coding challenges for the blink tutorial.
## Before we get started
Complete the [blink](/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`!

Просмотреть файл

@ -1,101 +0,0 @@
# blink lesson plan
Learn how to create a blinking LED script.
### @video vimeo/133778417
## Topic
Plot - Blinking LED
## Quick links
* [tutorial](/lessons/blink/tutorial)
* [quiz](/js/blink/quiz)
* [quiz answers](/lessons/blink/quiz-answers)
* [challenges](/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 programs 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...](/reference/led/plot)
* **pause**: [read more...](/reference/basic/pause)
* **clear screen**: [read more...](/reference/basic/clear-screen)
* **forever**: [read more...](/reference/basic/forever)
## Resources
* Activity: [tutorial](/lessons/blink/tutorial)
* Activity: [quiz](/lessons/blink/quiz)
* Extended Activity: [challenges](/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](/lessons/blink/tutorial)
* [quiz](/lessons/blink/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/lessons/blink/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/blink/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,46 +0,0 @@
# blink quiz answers
Learn how to create a blinking LED script.
This is the answer key for the [blink quiz](/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)
```
![](/static/mb/lessons/blink-0.png)
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)
```
![](/static/mb/lessons/blink-1.png)
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)
```
![](/static/mb/lessons/blink-2.png)
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)

Просмотреть файл

@ -1,40 +0,0 @@
# blink quiz
Learn how to create a blinking LED script.
## Name
## Directions
Use this activity document to guide your work in the [blink tutorial](/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)
```
![](/static/mb/empty-microbit.png)
## 3. Draw which LED is ON after running this code
```
led.plot(0, 0)
```
![](/static/mb/empty-microbit.png)
## 4. Draw which LED is ON after running this code
```
led.plot(4, 4)
```
![](/static/mb/empty-microbit.png)

Просмотреть файл

@ -1,97 +0,0 @@
# bop it lesson
a game where you have to keep up with the commands.
## Topic
Game Library
## Quick Links
* [tutorial](/lessons/bop-it/tutorial)
* [quiz](/lessons/bop-it/quiz)
* [quiz answers](/lessons/bop-it/quiz-answers)
* [challenges](/lessons/bop-it/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create a minesweeper game with **if**, `if condition do` , **global variables** to keep track of the action that the player is asked to perform. We will be learning how to create a bop it game using functions, global variables, if (conditionals), input on button pressed, math random, logo down, add score, as well as simple commands such as show string.
## Documentation
* **game library** : [read more...](/js/game-library)
* **global variables** : [read more...](/js/data)
* **assignment operator** : [read more...](/reference/variables/assignment)
* **functions** : [read more...](/js/function)
* **call** : [read more...](/js/call)
* **math random number** : [read more...](/js/math)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **on logo down** : [read more...](/functions/on-logo-down)
* **on shake** : [read more...](/reference/input/on-gesture)
* **if** : [read more...](/reference/logic/if)
* **show number** : [read more...](/reference/basic/show-number)
* **show string** : [read more...](/reference/basic/show-string)
## Objectives
* learn how the game library supports single-player, time-based games: a game library supports setting a number of lives, score, countdown clock, and levels.
* learn how to create a global variable as a place where you can store data so that you can use it later in your code, accessible across functions and in nested code blocks
* learn how the assignment operator is used to declare a new variable or update the value of a variable
* learn how to create a function as a unit of code that performs a specific task and returns a result to make the code easier to read, debug, and update
* learn how to call an existing function in the script
* learn how to return a random number
* learn how to run code when an input button is pressed
* learn how to run code when the BBC micro:bit is oriented perpendicularly to the floor with the logo down
* learn how to run code when the BBC micro:bit is shaken; when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show a string of the LED screen one character at a time (scrolling left to right)
* learn how to show a number on the LED screen one digit at a time (scrolling left to right)
## Links to the National Curriculum Programmes of Study for Computing
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/lessons/bop-it/tutorial)
* [quiz](/lessons/bop-it/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/bop-it/challenges)
## Homework
* Extended Activity: [challenges](/lessons/bop-it/challenges)

Просмотреть файл

@ -1,8 +0,0 @@
# compass lesson
build a compass app that applies the BBC micro:bit magnetic sensor (magnetometer).
build a compass app that applies the BBC micro:bit magnetic sensor (magnetometer)
* [tutorial](/lessons/compass/tutorial)
* [challenges](/lessons/compass/challenges)

Просмотреть файл

@ -1,88 +0,0 @@
# compass challenges
Display the direction that the BBC micro:bit is facing using the compass
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/compass/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
input.calibrate()
basic.forever(() => {
let degrees = input.compassHeading()
if (degrees < 45) {
basic.showString("N", 100)
} else if (degrees < 135) {
basic.showString("E", 100)
}
else if (degrees < 225) {
basic.showString("S", 100)
}
else {
basic.showString("W", 100)
}
})
```
### Challenge 1
Instead of displaying `N` when the BBC micro:bit is pointing North, display a star to indicate the north star.
```
input.calibrate()
basic.forever(() => {
let degrees1 = input.compassHeading()
if (degrees1 < 45) {
basic.plotImage(`
# . # . #
. # # # .
# # # # #
. # # # .
# . # . #
`) // ***
} else if (degrees1 < 135) {
basic.showString("E", 100)
}
else if (degrees1 < 225) {
basic.showString("S", 100)
}
else {
basic.showString("W", 100)
}
})
```
* Run your code to see if it works as expected
### Challenge 2
Instead of displaying just `N`, `W`, `S`, or `E`, display the full word.
```
input.calibrate()
basic.forever(() => {
let degrees2 = input.compassHeading()
if (degrees2 < 45) {
basic.showString("NORTH", 100) // ***
} else if (degrees2 < 135) {
basic.showString("EAST", 100) // ***
}
else if (degrees2 < 225) {
basic.showString("SOUTH", 100) // ***
}
else {
basic.showString("WEST", 100) // ***
}
})
```
* Run your code to see if it works as expected
### Challenge 3
Display your own unique message for each direction.

Просмотреть файл

@ -1,56 +0,0 @@
# compass quiz answers
Create an actual compass to show your direction: North, South, East, or West
## Name
## Directions
Use this activity document to guide your work in the [compass tutorial](/lessons/compass/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What is the purpose of the 'compass heading' block?
Gets the compass heading of the BBC micro:bit in degrees
<br/>
## 2. Write the code that stores the compass heading into a local variable called 'degrees'.
<br/>
```
let degrees = input.compassHeading()
```
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the BBC micro:bit
<br />
```
if (degrees < 45) {
basic.showString("N", 150)
}
```
## 3. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the BBC micro:bit
<br />
```
if (degrees < 135) {
basic.showString("E", 150)
}
```
## 3. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the BBC micro:bit
<br />
```
if (degrees < 225) {
basic.showString("S", 150)
}
```

Просмотреть файл

@ -1,32 +0,0 @@
# compass quiz
Create an actual compass to show your direction: North, South, East, or West
## Name
## Directions
Use this activity document to guide your work in the [compass tutorial](/lessons/compass/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. What is the purpose of the 'compass heading' block?
<br/>
## 2. Write the code that stores the compass heading into a local variable called 'degrees'.
<br/>
## 3. Write the 'If statement' that will check if the device is mostly pointing North. Display 'N' on the BBC micro:bit
<br />
## 3. Write the 'If statement' that will check if the device is mostly pointing East. Display 'E' on the BBC micro:bit
<br />
## 3. Write the 'If statement' that will check if the device is mostly pointing South. Display 'S' on the BBC micro:bit
<br />

Просмотреть файл

@ -1,80 +0,0 @@
# counter lesson
Learn how to create a counter with with on button pressed.
### @video td/videos/counter-0
## Topic
Variables
## Quick Links
* [activity](/lessons/counter/activity)
* [challenges](/lessons/counter/challenges)
* [quiz](/lessons/counter/quiz)
* [quiz answers](/lessons/counter/quiz-answers)
* [tutorial](/lessons/counter/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to creating a **variable** to keep track of the current count. We will be learning how to create a counter app using a variable as well as simple commands, such as on button pressed, and show number.
## Documentation
* **variable**: [read more...](/reference/variables/var)
* **arithmetic operators**: [read more...](/reference/types/number)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **show number** : [read more...](/reference/basic/show-number)
## Objectives
* learn how to create a variable as a place where you can store data so that you can use it later in your code, accessible across all functions, and in nested code blocks
* learn how arithmetic operators operate on numbers and return a number
* learn how to run code when an input button is pressed
* learn how to show a number on the LED screen, one digit at a time (scrolling from left to right)
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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.
* [activity](/lessons/counter/activity)
* [tutorial](/lessons/counter/tutorial)
* [quiz](/lessons/counter/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/counter/challenges)
## Homework
* Extended Activity: [challenges](/lessons/counter/challenges)

Просмотреть файл

@ -1,43 +0,0 @@
# counter activity
Display a number with a variable.
### ~avatar avatar
### @video td/videos/counter-0
Welcome! This tutorial will teach you how to make a counter that increments when button A is pressed. Let's get started!
### ~
Let's start by creating a **local variable** `count` to keep track of the current count.
```
let count = 0
```
The code under ``on button pressed("A")`` will run each time the user presses A. Let's add a line of code that increments `count` by `1`.
```
let count_ = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
})
```
Since the count has changed, it's time to refresh the screen display. Let's add a line of code to display the count on screen.
```
let count_1 = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
basic.showNumber(count, 150)
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/counter/challenges)!
### ~

Просмотреть файл

@ -1,38 +0,0 @@
# counter challenges
Coding challenges for the counter tutorial.
## Before we get started
Complete the following [guided tutorial](/lessons/counter/activity) At the end of the tutorial, your code should look like this:
```
let count = 0
input.onButtonPressed(Button.A, () => {
count = count + 1
basic.showNumber(count, 150)
})
```
### Challenge 1
### @video td/videos/counter-1-2
Let's add the code to `count` when `B` is pressed. Add an event handler with `input->on button pressed(B)` then add the code to `count`.
```
let count1 = 0
input.onButtonPressed(Button.A, () => {
count1 = count1 + 1
basic.showNumber(count1, 150)
})
input.onButtonPressed(Button.B, () => {
count1 = count1 - 1 // ***
basic.showNumber(count1, 150) // ***
}) // ***
```
### Challenge 3
Now let's try to reset the counter when the BBC micro:bit is shaken. You will need to register an event handler with `input->on shake`.

Просмотреть файл

@ -1,91 +0,0 @@
# counter lesson plan
Learn how to create a counter with with on button pressed.
### @video vimeo/134118661
## Topic
Variable - Counter
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to creating a **variable** to keep track of the current count. We will be learning how to create a counter app using global variables as well as simple commands, such as on button pressed, and show number.
## 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 programs 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
* **variables**: [read more...](/reference/variables/var)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **show number** : [read more...](/reference/basic/show-number)
## Resources
* Activity: [tutorial](/lessons/counter/tutorial)
* Activity: [quiz](/lessons/counter/quiz)
* Extended Activity: [challenges](/lessons/counter/challenges)
## Objectives
* learn how to create a variable
* learn how to blink a light
* learn how to repeat turning on and off the light
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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](/lessons/counter/tutorial)
* [quiz](/lessons/counter/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/lessons/counter/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/counter/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,91 +0,0 @@
# die roll lesson
create a die on the BBC micro:bit.
## Topic
If (Conditionals)
## Quick Links
* [activity](/lessons/die-roll/activity)
* [challenges](/lessons/die-roll/challenges)
* [quiz](/lessons/die-roll/quiz)
* [quiz answers](/lessons/die-roll/quiz-answers)
* [tutorial](/lessons/die-roll/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to use an if statements to run code run code depending on whether a condition is true or not. We will be learning how to create a die with If statements, On Shake, Variables, Assignment Operator, Pick Random and Show LEDs
## Documentation
* **Variables** : [read more...](/reference/variables/var)
* **If** : [read more...](/reference/logic/if)
* **On Shake** : [read more...](/reference/input/on-gesture)
* **Assignment Operator** : [read more...](/reference/variables/assign)
* **Math Random** : [read more...](/js/math)
* **Show LEDs** : [read more...](/reference/basic/show-leds)
## Objectives
* learn how to run code when the BBC micro:bit is shaken, when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to create a local variable as a place where you can store and retrieve data
* learn how the assignment operator is used to declare a new local variable
* learn how to declare a new local variable or update the value of a variable
* learn how to return a random number
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show an image on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Uses filters or can perform single criteria searches for information.(AL)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/die-roll/activity)
* [tutorial](/lessons/die-roll/tutorial)
* [quiz](/lessons/die-roll/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/die-roll/challenges)
## Homework
* Extended Activity: [challenges](/lessons/die-roll/challenges)

Просмотреть файл

@ -1,128 +0,0 @@
# die roll activity
Create a die on the BBC micro:bit
Let's create a condition for when the BBC micro:bit is shaken.
```
input.onGesture(Gesture.Shake, () => {
})
```
We need to show a random value from 1 to 6 on our die. So let's make a local variable called **roll**.
```
input.onGesture(Gesture.Shake, () => {
let roll = Math.random(6)
})
```
We need a condition for if **roll** is 5. We will show a `6` if **roll** is 5 because **roll** has a range from 0 to 5. We can use `Show LEDs` to display the side of a die that shows 6.
```
input.onGesture(Gesture.Shake, () => {
let roll1 = Math.random(6)
if (roll1 == 5) {
basic.showLeds(`
. # . # .
. . . . .
. # . # .
. . . . .
. # . # .
`, 400)
}
})
```
Let's use an `else if` condition for if **roll** is 4. If **roll** is 4 we can show 5 dots on the die.
```
input.onGesture(Gesture.Shake, () => {
let roll2 = Math.random(6)
if (roll2 == 5) {
basic.showLeds(`
. # . # .
. . . . .
. # . # .
. . . . .
. # . # .
`, 400)
} else if (roll2 == 4) {
basic.showLeds(`
. . . . .
. # . # .
. . # . .
. # . # .
. . . . .
`, 400)
}
})
```
Now we need to repeat the same steps for if **roll** is 3. If **roll** is 3 we will show `4` on the die. Let's also repeat these steps to show the 3, 2, and 1 on the die. We are almost done with our die!
```
input.onGesture(Gesture.Shake, () => {
let roll3 = Math.random(6)
if (roll3 == 5) {
basic.showLeds(`
. # . # .
. . . . .
. # . # .
. . . . .
. # . # .
`, 400)
} else if (roll3 == 4) {
basic.showLeds(`
. . . . .
. # . # .
. . # . .
. # . # .
. . . . .
`, 400)
}
else if (roll3 == 3) {
basic.showLeds(`
. . . . .
. # . # .
. . . . .
. # . # .
. . . . .
`, 400)
}
else if (roll3 == 2) {
basic.showLeds(`
# . . . .
. . . . .
. . # . .
. . . . .
. . . . #
`, 400)
}
else if (roll3 == 1) {
basic.showLeds(`
. . . . .
. # . . .
. . . . .
. . . # .
. . . . .
`, 400)
}
else {
basic.showLeds(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`, 400)
}
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/die-roll/challenges)!
### ~

Просмотреть файл

@ -1,201 +0,0 @@
# die roll challenges
Create a die on the BBC micro:bit.
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/die-roll/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
input.onGesture(Gesture.Shake, () => {
let roll = Math.random(6) // ***
if (roll == 5) {
basic.plotImage(`
. # . # .
. . . . .
. # . # .
. . . . .
. # . # .
`)
} else if (roll == 4) {
basic.plotImage(`
. . . . .
. # . # .
. . # . .
. # . # .
. . . . .
`)
}
else if (roll == 3) {
basic.plotImage(`
. . . . .
. # . # .
. . . . .
. # . # .
. . . . .
`)
}
else if (roll == 2) {
basic.plotImage(`
# . . . .
. . . . .
. . # . .
. . . . .
. . . . #
`)
}
else if (roll == 1) {
basic.plotImage(`
. . . . .
. # . . .
. . . . .
. . . # .
. . . . .
`)
}
else {
basic.plotImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
}
})
```
### Challenge 1
Modify the line of code with `math->random` so that only number 1-4 can appear on the die.
```
input.onGesture(Gesture.Shake, () => {
let roll1 = Math.random(4) // ***
if (roll1 == 5) {
basic.plotImage(`
. # . # .
. . . . .
. # . # .
. . . . .
. # . # .
`)
} else if (roll1 == 4) {
basic.plotImage(`
. . . . .
. # . # .
. . # . .
. # . # .
. . . . .
`)
}
else if (roll1 == 3) {
basic.plotImage(`
. . . . .
. # . # .
. . . . .
. # . # .
. . . . .
`)
}
else if (roll1 == 2) {
basic.plotImage(`
# . . . .
. . . . .
. . # . .
. . . . .
. . . . #
`)
}
else if (roll1 == 1) {
basic.plotImage(`
. . . . .
. # . . .
. . . . .
. . . # .
. . . . .
`)
}
else {
basic.plotImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
}
})
```
### Challenge 2
Let's make a trick die! Modify the line of code with `math->random` so that only numbers 3-6 can appear on the die. Also note that we need to ensure `roll = 0` when only 1 dot is shown on the BBC micro:bit.
```
input.onGesture(Gesture.Shake, () => {
let roll2 = Math.random(4) + 2 // ***
if (roll2 == 5) {
basic.plotImage(`
. # . # .
. . . . .
. # . # .
. . . . .
. # . # .
`)
} else if (roll2 == 4) {
basic.plotImage(`
. . . . .
. # . # .
. . # . .
. # . # .
. . . . .
`)
}
else if (roll2 == 3) {
basic.plotImage(`
. . . . .
. # . # .
. . . . .
. # . # .
. . . . .
`)
}
else if (roll2 == 2) {
basic.plotImage(`
# . . . .
. . . . .
. . # . .
. . . . .
. . . . #
`)
}
else if (roll2 == 1) {
basic.plotImage(`
. . . . .
. # . . .
. . . . .
. . . # .
. . . . .
`)
}
else if (roll2 == 0) {
basic.plotImage(`
. . . . .
. . . . .
. . # . .
. . . . .
. . . . .
`)
}
})
```
### Challenge 3
Add a couple more conditions so that the BBC micro:bit randomly chooses a number between 1 and 8.

Просмотреть файл

@ -1,91 +0,0 @@
# digi yoyo lesson
create a counter with a while loop.
### @video td/videos/digi-yoyo-0
## Topic
While Loop
## Quick Links
* [tutorial](/lessons/digi-yoyo/tutorial)
* [quiz](/lessons/digi-yoyo/quiz)
* [quiz answers](/lessons/digi-yoyo/quiz-answers)
* [challenges](/lessons/digi-yoyo/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to creating a **while loop**, `while condition do` to repeat code while a condition is true. We will be learning how to create a digi yoyo app using a while loop, a variable, as well as basic commands, such as pause and show number.
## Documentation
* **local variables** : [read more...](/reference/variables/var)
* **assignment operator** : [read more...](/reference/variables/assign)
* **while loop** : [read more...](/js/while)
* **relational operator ** : [read more...](/reference/types/number)
* **pause** : [read more...](/reference/basic/pause)
* **show number** : [read more...](/reference/basic/show-number)
## Objectives
* learn how to create a local variables to store data and use it in your code
* learn how to set or change the value of a local variable
* learn how to repeat code while a condition is true
* learn how a relational comparison (<) of numbers will yield a Boolean
* learn how to pause your code for the specified number of milliseconds
* learn how to show a number on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Uses filters or can perform single criteria searches for information.(AL)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/lessons/digi-yoyo/tutorial)
* [quiz](/lessons/digi-yoyo/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/digi-yoyo/challenges)
## Homework
* Extended Activity: [challenges](/lessons/digi-yoyo/challenges)

Просмотреть файл

@ -1,65 +0,0 @@
# digi yoyo challenges
Coding challenges for the digi yoyo.
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/digi-yoyo/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
let count = 0
while (count < 10) {
basic.pause(1000)
basic.showNumber(count, 150)
count = count + 1
}
```
### Challenge 1
How about we create a counter that counts backwards from 10 to 1? Let's add a while loop that executes only when `count` is greater than 0.
```
let count1 = 0
while (count1 < 10) {
basic.pause(1000)
basic.showNumber(count1, 150)
count1 = count1 + 1
}
while (count1 > 0) {
}
```
### Challenge 2
### @video td/videos/digi-yoyo-1-2
Inside of the while loop, let's add `pause->(1000)` so that we have a pause between each number as it's counting down. Also, let's show `count`!
```
let count2 = 0
while (count2 < 10) {
basic.pause(1000)
basic.showNumber(count2, 150)
count2 = count2 + 1
}
while (count2 > 0) {
basic.pause(1000) // ***
basic.showNumber(count2, 150) // ***
}
```
* Run the code to see if it works as expected.
### Challenge 3
Now, we need `count` to decrease by one after the BBC micro:bit has displayed the value of `count`.
We can do this by adding this line:
`count := count - 1`

Просмотреть файл

@ -1,93 +0,0 @@
# flashing heart lesson
Learn how to create LED images with a global variable.
### @video td/videos/flashing-heart-0
## Topic
Pause
## Quick links
* [activity](/lessons/flashing-heart/activity)
* [quiz](/lessons/flashing-heart/quiz)
* [quiz answers](/lessons/flashing-heart/quiz-answers)
* [challenges](/lessons/flashing-heart/challenges)
* [tutorial](/lessons/flashing-heart/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to **plot image** by turning on a series of LED lights on the LED screen. We will be learning how to create a blinking app using a forever loop as well as simple commands, such as plot image, pause, and clear screen.
## What the teacher needs to know / QuickStart Computing Glossary
**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 programs 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.**
## Documentation
* **forever**: [read more...](/reference/basic/forever)
* **plot image** : [read more...](/reference/led/plot-image)
* **pause**: [read more...](/reference/basic/pause)
* **clear screen**: [read more...](/reference/basic/clear-screen)
## Objectives
* learn how to repeat code in the background forever
* learn how to turn on a series of LED lights on the LED screen
* learn how to pause your code for the specified number of milliseconds
* learn how to turn off all the LED lights on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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
## Exercise
* time: 20 min.
* [activity](/lessons/flashing-heart/activity) or [tutorial](/lessons/flashing-heart/tutorial)
* [quiz](/lessons/flashing-heart/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/flashing-heart/challenges)
## Homework
* Extended Activity: [challenges](/lessons/flashing-heart/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,61 +0,0 @@
# flashing heart activity
Ccontrol images with variables.
### ~avatar avatar
### @video td/videos/flashing-heart-0
In this activity, you will learn how to blink an image on the LED screen.
### ~
Let's start by adding code that plots a heart image on the screen using `basic->plot image`. Once you are done coding, don't forget to run your code in the simulator or the BBC micro:bit.
```
basic.plotImage(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .
`) // ***
```
We want to leave the image on the screen for 0.5 seconds (500 milliseconds), then clear the screen. We can use `basic->pause` to wait and `basic->clear screen` to turn off the LEDs.
```
basic.plotImage(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .
`)
basic.pause(500) // ***
basic.clearScreen() // ***
```
Finally, we can surround this code with a `basic->forever` loop to repeat it and add a pause after `basic->clear screen` to keep the screen off for a little while. Modify your code so that your code looks like this.
```
basic.forever(() => {
basic.plotImage(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .
`)
basic.pause(500)
basic.clearScreen()
basic.pause(500)
})
```
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/flashing-heart/challenges)!
### ~

Просмотреть файл

@ -1,93 +0,0 @@
# flashing heart challenges
Coding challenges for flashing heart.
## Before we get started
Complete the [flashing heart](/lessons/flashing-heart/activity) activity and your code will look like this:
```
basic.forever(() => {
basic.plotImage(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .
`)
basic.pause(500)
basic.clearScreen()
basic.pause(500)
})
```
### Challenge 1
### @video td/videos/flashing-heart-1
Let's plot a different image. Let's display a broken heart!
To do this, you need to **add a line** between the last line and the end loop. Plot the image of the broken heart and then add a pause of 500 milliseconds.
```
basic.forever(() => {
basic.plotImage(`
# # . # #
# # # # #
# # # # #
. # # # .
. . # . .
`)
basic.pause(500)
basic.clearScreen()
basic.pause(500)
basic.plotImage(`
. # . # .
# . # # #
# . . # #
. # # # .
. . # . .
`) // ***
basic.pause(500) // ***
})
```
* click `run main` to see if the code works as expected.
### Challenge 2
### @video td/videos/flashing-heart-2
Now let's alternate flashing the heart and the broken heart. To do this, we need to clear the screen and then add a pause of 500 milliseconds under the new code we added in Challenge 1.
```
basic.forever(() => {
basic.plotImage(`
# # . # #
# # # # #
# # # # #
. # # # .
. . # . .
`)
basic.pause(500)
basic.clearScreen()
basic.pause(500)
basic.plotImage(`
. # . # .
# . # # #
# . . # #
. # # # .
. . # . .
`)
basic.pause(500)
basic.clearScreen() // ***
basic.pause(500) // ***
})
```
* click `run main` to see if the code works as expected.
### Challenge 3
You now have a heart and broken heart flashing! Now plot a new image to alternate in with the heart and broken heart.

Просмотреть файл

@ -1,102 +0,0 @@
# flashing heart lesson plan
Learn how to create LED images with a variable.
### @video vimeo/134118661
## Topic
Global Variable - Blinking Images
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to control a blinking LED image. We will be learning how to create a blinking app using global variables, forever as well as simple commands, such as create image, show image, 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 programs 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
* **global variables**: [read more...](/js/data)
* **create image** : [read more...](/reference/images/create-image)
* **show image** : [read more...](/reference/images/show-image)
* **pause**: [read more...](/reference/basic/pause)
* **clear screen**: [read more...](/reference/basic/clear-screen)
* **forever**: [read more...](/reference/basic/forever)
## Resources
* Activity: [tutorial](/lessons/flashing-heart/tutorial)
* Activity: [quiz](/lessons/flashing-heart/quiz)
* Extended Activity: [challenges](/lessons/flashing-heart/challenges)
## Objectives
* learn how to create a global variable
* learn how to blink a light
* learn how to repeat turning on and off the light
## Links to the National Curriculum Programmes of Study for Computing
## Assessment
### Progression Pathways
### Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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](/lessons/flashing-heart/tutorial)
* [quiz](/lessons/flashing-heart/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/lessons/flashing-heart/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/flashing-heart/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,38 +0,0 @@
# flashing heart quiz answers
Learn how to create images with global variables.
This is the answer key for the [flashing heart quiz](/lessons/flashing-heart/quiz).
## 1. Describe what `basic->show leds` does
Show LEDs displays an Image on the BBC micro:bit's LED screen
## 2. Draw the areas being displayed on the BBC micro:bit
```
basic.showLeds(`
# # . # #
# # # # #
# # # # #
. # # # .
. . # . .
`, 400)
```
![](/static/mb/lessons/flashing-heart-0.png)
## 3. Write the code to show LEDs of a broken heart forever.
```
basic.forever(() => {
basic.showLeds(`
# # . # #
# . # # #
# # . # #
. # . # .
. . # . .
`, 400)
})
```

Просмотреть файл

@ -1,36 +0,0 @@
# flashing heart quiz
Learn how to create a blinking LED script with a variable.
## Name
## Directions
Use this activity document to guide your work in the [flashing heart activity](/lessons/flashing-heart/activity).
Answer the questions while completing the activity. Pay attention to the dialogues!
## 1. Describe what pause does?
<br/>
## 2. Draw the image being displayed using the BBC micro:bit image.
```
basic.showLeds(`
. # . # .
# # # # #
# # # # #
. # # # .
. . # . .
`, 400)
```
![](/static/mb/empty-microbit.png)
<br/>
## 3. Write the code to show LEDs of a broken heart forever.
<br/>

Просмотреть файл

@ -1,124 +0,0 @@
# flipping bird lesson
count the number of times the BBC micro:bit has been shaken.
### @video td/videos/flipping-bird-0
## Topic
Math - Modulo
## Quick Links
* [tutorial](/lessons/flipping-bird/tutorial)
* [quiz](/lessons/flipping-bird/quiz)
* [quiz answers](/lessons/flipping-bird/quiz-answers)
* [challenges](/lessons/flipping-bird/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to return the **modulus**, `math->mod` to determine if you will plot image. We will be learning how to return the modulus by using a local variable, input on shake, if (conditional), modulo, as well as simple commands such as plot image.
## What the teacher needs to know / QuickStart Computing Glossary
* Algorithm: An unambiguous set of rules or a precise step-bystep guide to solve a problem or achieve a particular objective.
* Input: Data provided to a computer system, such as via a keyboard, mouse, microphone, camera or physical sensors.
* Output: The information produced by a computer system for its user, typically on a screen, through speakers or on a printer, but possibly through the control of motors in physical systems.
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
* 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.
* Repetition: Executing a section of computer code a number of times as part of the program.
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
* Variables: A way in which computer programs can store, retrieve or change data, such as a score, the time left, or the users name.
## Documentation
* **global variables** : [read more...](/js/data)
* **on shake** : [read more...](/reference/input/on-gesture)
* **if** : [read more...](/reference/logic/if)
* **math modulo** : [read more...](/js/math)
* **plot image** : [read more...](/reference/led/plot-image)
## Resources
* Activity: [tutorial](/lessons/flipping-bird/tutorial)
* Activity: [quiz](/lessons/flipping-bird/quiz)
* Extended Activity: [challenges](/lessons/flipping-bird/challenges)
## Objectives
* learn how to create a local variable as a place where you can store data, so that you can use it in your code, across functions, and in nested code blocks
* learn how to run code when the micro:bit is shaken; when running code in the browser, moving the mouse quickly simulates shaking
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to return the modulus
* learn how to display an image on the BBC micro:bit's LED screen
## Links to the National Curriculum Programmes of Study for Computing
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Shows an awareness of tasks best completed by humans or computers (EV)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Uses post-tested loop e.g.until,and a sequence of selection statements in programs,including an if,then and else statement(AL)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Uses filters or can perform single criteria searches for information.(AL)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Information Technology
* Collects, organizes, 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)
* Uses criteria to evaluate the quality of solutions, can identify improvements making some refinements to the solution, and future solutions (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/lessons/flipping-bird/tutorial)
* [quiz](/lessons/flipping-bird/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/flipping-bird/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/flipping-bird/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,191 +0,0 @@
# foo
blank lesson #docs
### ~screen TODO
### @video vimeo/134121040
### ~
## Topic TODO:
Basic - Show Number
## Quick Links TODO:
* [tutorial](/lessons/lucky-7/tutorial)
* [quiz](/lessons/lucky-7/quiz)
* [quiz answers](/lessons/lucky-7/quiz-answers)
* [challenges](/lessons/lucky-7/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work TODO:
Learn how to creating a **global number variable**, `data->count` to keep track of the current count. We will be learning how to create a counter app using global variables as well as simple commands, such as on button pressed, and show number.
## What the teacher needs to know TODO:
* Acceptable Use Policy (AUP): An Acceptable Use Policy comprises a set of rules applied by the owner/manager of a network, website or large computer system that defines the ways in which the network, site or system may be used.
* Algorithm: An unambiguous set of rules or a precise step-bystep guide to solve a problem or achieve a particular objective.
* Command: An instruction for the computer to execute, written in a particular programming language.
* Computational thinking: Thinking about systems or problems in a way that allows computer systems to be used to model or solve these.
* Computer networks: The computers and the connecting hardware (wifi access points, cables, fibres, switches and routers) that make it possible to transfer data using an agreed method (protocol).
* Creative Commons: A licensing scheme where the creator of an original work allows others to use it without seeking further permission, subject to a number of agreed conditions: www. creativecommons.org.
* Data: A structured set of numbers, possibly representing digitised text, images, sound or video, which can be processed or transmitted by a computer, also used for numerical (quantitative) information.
* Debug: To fix the errors in a program.
* Decomposing: The process through which problems or systems are broken down into their component parts, each of which may then be considered separately.
* Domain Name Service (DNS): The distributed automatic system that converts domain names into the IP addresses which are used for routing packets via the internet.
* Encrypt: To securely encode information so that it can only be read by those knowing both the system used and a secret, private key.
* E-safety: Used to describe behaviours and policies intended to minimise the risks to a user of using digital technology, particularly the internet.
* Generalisation: A computational thinking process in which general solutions or models are preferred to or derived from particular cases.
* Hardware: The physical systems and components of digital devices; see also software.
* Hypertext mark-up language (HTML): HTML is the language in which web pages are composed.
* Hypertext transfer protocol (HTTP): HTTP is the standard protocol for the request and transmission of HTML web pages between browser and web server.
* Input: Data provided to a computer system, such as via a keyboard, mouse, microphone, camera or physical sensors.
* Interface: The boundary between one system and another – often used to describe how a person interacts with a computer.
* Internet Protocol (IP) addresses: Numeric addresses uniquely specifying computers directly connected to the internet, also used on private networks to uniquely identify computers on that network.
* Loop: A block of code repeated automatically under the programs control.
* Network server: A computer connected to a local area network providing services – such as file storage, printing, authentication, web access or email – automatically to other computers on the network.
* Open source software: Software in which the source code is made available for others to study, and typically adapt, usually with few if any restrictions.
* Operating system: The programs on a computer which deal with internal management of memory, input/output, security and so on, such as Windows 8 or iOS.
* Output: The information produced by a computer system for its user, typically on a screen, through speakers or on a printer, but possibly through the control of motors in physical systems.
* Packets of data: A small set of numbers that get transmitted together via the internet, typically enough for 1000 or 1500 characters.
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
* 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.
* Repetition: Executing a section of computer code a number of times as part of the program.
* Router: Network hardware which forwards packets of data onwards to the most appropriate hardware to which it is connected.
* Screencast: A recording of on-screen action that is often accompanied by an audio narration.
* Script: A computer program typically executed one line at a time through an interpreter, such as the instructions for a Scratch character.
* Selection: A programming construct in which one section of code or another is executed depending on whether a particular condition is met.
* Sequence: To place program instructions in order, with each executed one after the other.
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
* Sprite: A computer graphics object that can be controlled (programmed) independently of other objects or the background.
* Uniform Resource Locator (URL): A standard for specifying the location on the internet of certain files.
* Variables: A way in which computer programs can store, retrieve or change data, such as a score, the time left, or the users name.
* Web server: A service running on a computer (or sometimes for the computer itself) that returns HTML data for a web page when it receives an HTTP request via the local network or the internet.
* World Wide Web: A service provided by computers connected to the internet (web servers), in which pages of hypertext (web pages) are transmitted to users.
**QuickStart Computing Glossary
## Documentation TODO:
* **show number** : [read more...](/reference/basic/show-number)
## Resources TODO:
* Activity: [tutorial](/lessons/lucky-7/tutorial)
* Activity: [quiz](/lessons/lucky-7/quiz)
* Extended Activity: [challenges](/lessons/lucky-7/challenges)
## Objectives TODO:
* learn how to create a global variable
* learn how to blink a light
* learn how to repeat turning on and off the light
## Links to the National Curriculum Programmes of Study for Computing TODO:
## Progression Pathways / Computational Thinking Framework TODO:
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Shows an awareness of tasks best completed by humans or computers (EV)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Uses post-tested loop e.g.until,and a sequence of selection statements in programs,including an if,then and else statement(AL)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Designs, writes and debugs modular programs using procedures(AL) (DE) (AB) (GE)
* Knows that a procedure can be used to hide the detail with sub-solution(AL) (DE) (AB) (GE)
* Understands that programming bridges the gap between algorithmic solutions and computers(AB)
* Has practical experience of a high-level textual language, including using standard libraries when programming(AB) (AL)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Knows why sorting data in a flat file can improve searching for information (EV)
* Uses filters or can perform single criteria searches for information.(AL)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Analyses and evaluates data and information, and recognises that poor quality data leads to unreliable re sults,and inaccurate conclusions (AL) (EV)
* Knows that digital computers use binary to represent all data (AB)
* Understands how bit patterns represent numbers and images (AB)
* Knows that computers transfer data in binary (AB)
* Understands the relationship between binary and file size (uncompressed) (AB)
* Defines data types: real numbers and Boolean (AB)
* Queries data on one table using a typical query language (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
* Understands the difference between hardware and application software, and their roles within a computer system (AB)
* Understands why and when computers are used (EV)
* Understands the main functions of the operating system (DE) (AB)
* Knows the difference between physical, wireless and mobile networks (AB)
* Recognises and understands the function of the main internal parts of basic computer architecture (AB)
* Understands the concepts behind the fetch-execute cycle (AB) (AL)
* Knows that there is a range of operating systems and application software for the same hardware (AB)
#### Communication Networks
* Understands the difference between the internet and internet service e.g. world wide web (AB)
* Shows an awareness of, and can use a range of internet services e.g. VOIP.
* Understands why and when computers are used (EV)
* Selects, combines and uses internet services (EV)
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
* Understands how to construct static web pages using HTML and CSS (AL) (AB)
* Understands data transmission between digital computers over networks, including the internet i.e. IP addresses and packet switching. (AL) (AB)
#### Information Technology
Collects, organizes, and presents data and information in digital content (AB)
* Creates digital content to achieve a given goal through combining software packages and internet services to communicate with a wider audience e.g. blogging (AL)
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
* * Makes judgements about digital content when evaluating and repurposing it for a given audience (EV) (GE)
* Recognises the audience when designing and creating digital content (EV)
* Understands the potential of information technology for collaboration when computers are networked (GE)
* Uses criteria to evaluate the quality of solutions, can identify improvements making some refinements to the solution, and future solutions (EV)
* Evaluates the appropriatness of digital devices, internet services and application software to achieve given goals (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.
* Designs criteria to critically evaluate the quality of solutions, uses the criteria to identify improvements and can make appropriate refinements to the solution (EV)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity TODO:
* time: 20 min.
* [tutorial](/lessons/lucky-7/tutorial)
* [quiz](/lessons/lucky-7/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity TODO:
* time: 20 min.
* [challenges](/lessons/lucky-7/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework TODO:
* Extended Activity: [challenges](/lessons/lucky-7/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,90 +0,0 @@
# glowing pendulum lesson
construct a pendulum that glows using acceleration.
## Topic
Acceleration
## Quick Links
* [activity](/lessons/glowing-pendulum/activity)
* [challenges](/lessons/glowing-pendulum/challenges)
* [quiz](/lessons/glowing-pendulum/quiz)
* [quiz answers](/lessons/glowing-pendulum/quiz-answers)
* [tutorial](/lessons/glowing-pendulum/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to get the acceleration **acceleration**, `input->acceleration` value (g-force), in one of three specified dimensions. We will be learning how to get the acceleration using forever loop, a local variable, acceleration, the math library, as well as simple commands, such as led set brightness and led plot all.
## Documentation
* **forever** : [read more...](/reference/basic/forever)
* **local variable** : [read more...](/reference/variables/var)
* **acceleration** : [read more...](/reference/input/acceleration)
* **absolute value** : [read more...](/js/math)
* **set brightness** : [read more...](/reference/led/set-brightness)
* **plot** : [read more...](/reference/led/set-brightness)
## Objectives
* learn how to repeat code in the background forever
* learn how create a local variable to store data, so that you can use it in your code
* learn how to get the acceleration value (g-force), in one of three specified dimensions
* learn how to return the absolute value
* learn how to sets the brightness of the LED screen
* learn how to turn on all the LED lights on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Uses filters or can perform single criteria searches for information.(AL)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/glowing-pendulum/activity)
* [tutorial](/lessons/glowing-pendulum/tutorial)
* [quiz](/lessons/glowing-pendulum/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/glowing-pendulum/challenges)
## Homework
* Extended Activity: [challenges](/lessons/glowing-pendulum/challenges)

Просмотреть файл

@ -1,73 +0,0 @@
# glowing pendulum activity
construct a pendulum that glows using acceleration. #docs
### ~avatar avatar
Welcome! This guided activity will teach how to construct a pendulum that glows using acceleration. Let's get started!
### ~
Create a **forever** loop that will constantly display the appropriate brightness on the LED display.
```
basic.forever(() => {
})
```
Now let's measure the acceleration on the `y` axis and store that value in a variable. The `input->acceleration("y")` function will provide the value.
```
basic.forever(() => {
let acceleration = input.acceleration("y")
})
```
Since the micro:bit will be swinging back and forth, the acceleration will only be positive half of the time. Thus, to always get a positive value, we want to take the absolute value of the acceleration.
```
basic.forever(() => {
let acceleration1 = input.acceleration("y")
acceleration1 = math.abs(acceleration1)
})
```
The function `input->acceleration("y")` returns a number between 0 and 1024. We want to use this value for the brightness of the micro:bit, but the `led->set brightness()` only accepts a value between 0 and 256. Thus, we need to divide the acceleration by 4 to ensure we will be in the appropriate range.
```
basic.forever(() => {
let acceleration2 = input.acceleration("y")
acceleration2 = math.abs(acceleration2)
acceleration2 = acceleration2 / 4
})
```
Now let's use our acceleration value to set the brightness on the BBC micro:bit.
```
basic.forever(() => {
let acceleration3 = input.acceleration("y")
acceleration3 = math.abs(acceleration3)
acceleration3 = acceleration3 / 4
led.setBrightness(acceleration3)
})
```
Let's show what the brightness of the micro:bit is by turning all the LEDs on!
```
basic.forever(() => {
let acceleration4 = input.acceleration("y")
acceleration4 = math.abs(acceleration4)
acceleration4 = acceleration4 / 4
led.setBrightness(acceleration4)
led.plotAll()
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/glowing-pendulum/challenges)!
### ~

Просмотреть файл

@ -1,32 +0,0 @@
# glowing pendulum challenges
Coding challenges for the glowing pendulum tutorial. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/glowing-pendulum/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
basic.forever(() => {
let acceleration = input.acceleration("y")
acceleration = math.abs(acceleration)
acceleration = acceleration / 4
led.setBrightness(acceleration)
led.plotAll()
})
```
**Challenge 1**
![](/static/mb/lessons/glowing-pendulum-0.jpg)
Hold the BBC micro:bit in your hand in a dark room. Move the BBC micro:bit like a pendulum, and produce a slow image that captures the pattern of the BBC micro:bit LEDs.
**Challenge 2**
Replace "y" in `[input->acceleration("y")] with "x" or "z". Changing the axis will cause the BBC micro:bit to measure the force in a different direction. What differences in the resulting pattern does this replacement make?

Просмотреть файл

@ -1,84 +0,0 @@
# guess the number lesson
Learn to create a random number with input from button A.
### @video td/videos/guess-the-number-0
## Topic
Math - Random Numbers
## Quick links
* [activity](/lessons/guess-the-number/activity)
* [challenges](/lessons/guess-the-number/challenges)
* [quiz](/lessons/guess-the-number/quiz)
* [quiz answers](/lessons/guess-the-number/quiz-answers)
* [tutorial](/lessons/guess-the-number/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create numbers randomly by using the input of the BBC micro:bit. We will be learning how to create random numbers with input using a local variable as well as simple commands, such as math->random, and show number.
## Documentation
* **on button pressed**: [read more...](/reference/input/on-button-pressed)
* **local variable **: [read more...](/reference/variables/var)
* **assignment operator**: [read more...](/reference/variables/assign)
* **show number**: [read more...](/reference/basic/show-number)
* **random numbers**: [read more...](/js/math)
* **clear screen**: [read more...](/reference/basic/clear-screen)
## Objectives
* learn how to run code when an input button is pressed
* learn how a variable is a place where you can store data
* learn how to set the value of a local variable
* learn how to returns a random number
* learn how to show a number on the LED screen, one digit at a time (scrolling left to right)
* learn how to turn off all the LED lights on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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.
* [activity](/lessons/guess-the-number/activity)
* [tutorial](/lessons/guess-the-number/tutorial)
* [quiz](/lessons/guess-the-number/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/guess-the-number/challenges)
## Homework
* Extended Activity: [challenges](/lessons/guess-the-number/challenges)

Просмотреть файл

@ -1,42 +0,0 @@
# guess the number activity
guess the number with math random.
### ~avatar avatar
### @video td/videos/guess-the-number-0
Welcome! This tutorial will help you create a guess the number game! Let's get started!
### ~
Add an event handler when button `A` is pressed.
```
input.onButtonPressed(Button.A, () => {
})
```
Create a local variable of type number `x` and set it to a random number using `math->random`. `math->random(10)` generates a random number between `0` and `10` **excluded**.
```
input.onButtonPressed(Button.A, () => {
let x = Math.random(10)
})
```
Show the random number on the screen.
```
input.onButtonPressed(Button.A, () => {
let x1 = Math.random(10)
basic.showNumber(x1, 150)
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/guess-the-number/challenges)!
### ~

Просмотреть файл

@ -1,39 +0,0 @@
# guess the number challenges
Coding challenges for the guess the number tutorial. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/guess-the-number/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
input.onButtonPressed(Button.A, () => {
let x = Math.random(10)
basic.showNumber(x, 150)
})
```
### Challenge 1
### @video td/videos/guess-the-number-2
When button `B` is pressed, we want to clear the screen. This will make it so users can play your game over and over again! Add an event handler to handle this case.
```
input.onButtonPressed(Button.A, () => {
let x1 = Math.random(10)
basic.showNumber(x1, 150)
})
input.onButtonPressed(Button.B, () => {
basic.clearScreen() // ***
})
```
### Challenge 2
Show an animation when you clear the screen! Choose what animation makes most sense to you. Be creative!

Просмотреть файл

@ -1,99 +0,0 @@
# guess the number lesson plan
Learn how to create a random number with input from button A.
### @video vimeo/134121077
## Topic
Input - Random Numbers
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create numbers randomly by using the input of the BBC micro:bit. We will be learning how to create random numbers with input using a local variable as well as simple commands, such as math->random, and show number.
## 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 programs 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
* **local variables**: [read more...](/reference/variables/var)
* **math**: [read more...](/js/math)
* **on button pressed**: [read more...](/reference/input/on-button-pressed)
## Resources
* Activity: [tutorial](/lessons/guess-the-number/tutorial)
* Activity: [quiz](/lessons/guess-the-number/quiz)
* Extended Activity: [challenges](/lessons/guess-the-number/challenges)
## Objectives
* learn how to create a global variable
* learn how a rotating animation
* learn how to repeat the animation
## Links to the National Curriculum Programmes of Study for Computing
## Assessment
### Progression Pathways
### Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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](/lessons/guess-the-number/tutorial)
* [quiz](/lessons/guess-the-number/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/lessons/guess-the-number/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/guess-the-number/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,56 +0,0 @@
# hack your headphones activity
hack your headphones.
# BBC micro:bit music
![](/static/mb/lessons/hack-your-headphones-0.png)
In this project, you will build your own music player BBC micro:bit from headphones. Project duration: 15 minutes.
## Materials
* BBC micro:bit, battery holder and 2 AAA batteries
* Headphones
* Crocodile clips
## Steps
### Step 1
![](/static/mb/lessons/banana-keyboard-1.png)
Using the 1st crocodile clip, connect the end of the crocodile clip onto GND pin on the BBC micro:bit.
### Step 2
![](/static/mb/lessons/banana-keyboard-2.png)
![](/static/mb/lessons/banana-keyboard-3.png)
Using the 2nd crocodile clip, connect the end of the crocodile clip onto the 0 pin on the BBC micro:bit.
### Step 3
![](/static/mb/lessons/banana-keyboard-4.png)
Using the 1st crocodile clip, connect the second end of the crocodile clip onto based of the headphone jack. The base of your headphone jack is considered the ground so it is connected to the GND of the BBC micro:bit.
### Step 4
![](/static/mb/lessons/banana-keyboard-5.png)
![](/static/mb/lessons/hack-your-headphones-1.png)
Using the 2nd crocodile clip, connect the second end of the crocodile clip onto the tip of the headphone jack. The tip of your headphone jack feeds into the right speaker on the headphone. You connect from the BBC micro:bit pin 0 to the tip of the right side of your headphone. Use the tip of the headphone jack to play sounds.
### Step 5
![](/static/mb/lessons/hack-your-headphones-0.png)
You hacked your headphones!
### Step 6
Connect your BBC micro:bit to your computer using your USB cable and run the [happy birthday](/dnnzgd) script on it. Press the reset button to restart your music player!

Просмотреть файл

@ -1,80 +0,0 @@
# looper lesson
Learn to control blinking LEDs.
### @video td/videos/looper-0
## Topic
For Loop
## Quick links
* [tutorial](/lessons/looper/tutorial)
* [quiz](/lessons/looper/quiz)
* [quiz answers](/lessons/looper/quiz-answers)
* [challenges](/lessons/looper/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 the for loop as well as simple commands, such as plot and pause.
## Documentation
* **for**: [read more...](/reference/loops/for)
* **show number**: [read more...](/reference/basic/show-number)
* **pause**: [read more...](/reference/basic/pause)
* **arithmetic operators**: [read more...](/reference/types/number)
## Objectives
* learn how to repeat code a fixed number of times
* learn how to show a number on the LED screen, one digit at a time (scrolling from left to right)
* learn how to pause program execution for the specified number of milliseconds
* learn how to arithmetic operators operate on numbers and return a number
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses logical reasoning to predict outputs, showing an awareness of inputs. (AL)
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Uses a variable and relational operators within a loop to govern termination. (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (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: 10 min.
* [tutorial](/lessons/looper/tutorial)
* [quiz](/lessons/looper/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/looper/challenges)
## Homework
* Extended Activity: [challenges](/lessons/looper/challenges)

Просмотреть файл

@ -1,104 +0,0 @@
# love meter lesson
create a love meter with the BBC micro:bit.
### @video td/videos/love-meter-0
## Topic
On Pin Pressed
## Quick Links
* [activity](/lessons/love-meter/activity)
* [challenges](/lessons/love-meter/challenges)
* [quiz](/lessons/love-meter/quiz)
* [quiz answers](/lessons/love-meter/quiz-answers)
* [tutorial](/lessons/love-meter/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to use the pins **pin pressed**, `input->on pin pressed` to run code when the user holds the GND pin with one hand, and presses pin 0 with the other hand, thus completing a circuit. We will be learning how to create a love meter using input on pin pressed, a local variable, math random, If (conditional) as well as simple commands, such as show number, pause, and show string.
## Documentation
* **on pin pressed** : [read more...](/reference/input/on-pin-pressed)
* **local variable** : [read more...](/reference/variables/var)
* **Boolean** : [read more...](/reference/types/boolean)
* **math random** : [read more...](/js/math)
* **show number** : [read more...](/reference/basic/show-number)
* **pause** : [read more...](/reference/basic/pause)
* **If** : [read more...](/reference/logic/if)
* **show string** : [read more...](/reference/basic/show-string)
## Objectives
* learn how to run code when the user holds the GND pin in one hand, and presses pin 0 with the other hand, thus completing a circuit; when you run a script with this function in a web browser, click pin 0 on the simulator
* learn how to a create a variable for a place where you can store and retrieve data
* learn how Boolean operators take Boolean inputs and evaluates to a Boolean output
* learn how to return a random number
* learn how to show a number on the LED screen
* learn how to pause your code for the specified number of milliseconds
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show a string on the LED screen one character at a time (scrolling from left to right)
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Uses filters or can perform single criteria searches for information.(AL)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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)
* Makes judgements about digital content when evaluating and repurposing it for a given audience (EV) (GE)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/love-meter/activity)
* [tutorial](/lessons/love-meter/tutorial)
* [quiz](/lessons/love-meter/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/love-meter/challenges)
## Homework
* Extended Activity: [challenges](/lessons/love-meter/challenges)

Просмотреть файл

@ -1,42 +0,0 @@
# love meter activity
create a love meter with the BBC micro:bit #docs
### ~avatar avatar
### @video td/videos/love-meter-0
Welcome! This tutorial will help you create a love meter with the BBC micro:bit. Let's get started!
### ~
Begin by registering an event with `input->on pin pressed(PO)` to know when someone is holding pin ``P0`` and pin ``Gnd``.
```
input.onPinPressed(TouchPin.P0, () => {
})
```
We are going to create a meter that displays a random number from 0 to 10. We use ``11`` as `math->random(n)` returns a number between ``0`` and ``n-1``.
```
input.onPinPressed(TouchPin.P0, () => {
let x = Math.random(11)
})
```
Finally, let's show that number on the micro:bit.
```
input.onPinPressed(TouchPin.P0, () => {
let x_ = Math.random(11)
basic.showNumber(x_, 150)
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/love-meter/challenges)!
### ~

Просмотреть файл

@ -1,72 +0,0 @@
# love meter challenges
create a love meter with the BBC micro:bit #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/love-meter/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
input.onPinPressed(TouchPin.P0, () => {
let x = Math.random(11)
basic.showNumber(x, 150)
})
```
### Challenge 1
Add a pause of 3000 milliseconds (3 seconds) after showing the number so that the number won't immediately disappear in the next challenge.
```
input.onPinPressed(TouchPin.P0, () => {
let x1 = Math.random(11)
basic.showNumber(x1, 150)
basic.pause(3000) // ***
})
```
### Challenge 2
If the rating **x** is between ``0`` and ``3`` (strictly less than ``4``), display the text "HORRIBLE!".
```
input.onPinPressed(TouchPin.P0, () => {
let x2 = Math.random(11)
basic.showNumber(x2, 150)
basic.pause(3000)
if (x2 < 4) {
basic.showString("HORRIBLE!", 150) // ***
}
})
```
### Challenge 3
### @video td/videos/love-meter-3
If the rating is between 4 and 7, display the text "MEDIOCRE!" **else** display the text "MATCHED!"
```
input.onPinPressed(TouchPin.P0, () => {
let x3 = Math.random(11)
basic.showNumber(x3, 150)
basic.pause(3000)
if (x3 < 4) {
basic.showString("HORRIBLE!", 150) // ***
} else if (x3 < 8) {
basic.showString("MEDIOCRE!", 150) // ***
}
else {
basic.showString("MATCHED!", 150) // ***
}
})
```
### Challenge 4
Use `basic->plot image` or `basic->show animation` to display images and animations instead of text for each case.

Просмотреть файл

@ -1,45 +0,0 @@
# love meter quiz answers
The answers to the love meter quiz.
This is the answer key for the [love meter quiz](/lessons/love-meter/quiz).
## 1. What does on pin pressed ("P0") do?
<br/>
It's a method that runs code when the user holds the GND pin with a finger of one hand and presses pin P0, completing a circuit.
## 2. Create a condition for on pin pressed ("P1").
```
input.onPinPressed(TouchPin.P1, () => {
})
```
## 3. What does this line of code generate?
```
let x = Math.random(10)
```
<br/>
It generates a random number between 0 and 9 then stores that number in a variable.
## 4. Why do you have to add 1 to variable x?
```
x = x + 1
```
<br/>
You have to add 1 if you want to generate a random number between 1 and 10 .
## 5. Why do you have to hold ground (GND) to make this work on the BBC micro:bit?
<br/>
You have told GND to complete the circuit.

Просмотреть файл

@ -1,41 +0,0 @@
# love meter quiz
Learn how to make a love meter that you can try with someone.
## Name
## Directions
Use this activity document to guide your work in the [love meter tutorial](/lessons/love-meter/tutorial).
Answer the questions below while completing the tutorial. Pay attention to the dialogues!
## 1. Describe what "input -> on pin pressed (P0)" does?
<br/>
## 2. Create a condition for on pin pressed ("P1").
<br/>
## 3. Describe what this line of code does?
```
let x = Math.random(10)
```
<br/>
## 4. Describe what adding 1 to variable x does?
```
let x_ = Math.random(10)
x = x + 1
```
<br/>
## 5. Describe why you must hold ground (GND) before pressing (P0) to run a program using "input -> on pin pressed (P0)" on the BBC micro:bit
<br/>

Просмотреть файл

@ -1,84 +0,0 @@
# lucky 7 lesson
show a number on the LED screen.
### @video td/videos/lucky-7-0
## Topic
Show Number
## Quick Links
* [activity](/lessons/lucky-7/activity)
* [quiz](/lessons/lucky-7/quiz)
* [quiz answers](/lessons/lucky-7/quiz-answers)
* [challenges](/lessons/lucky-7/challenges)
* [tutorial](/lessons/lucky-7/tutorial)
## Class
Year 7
## Prior learning / place of lesson in scheme of work
Learn how to display a number, `basic-> show number` to generate numbers. We will be learning how to create numbers using show number and pause.
## Documentation
* **show number** : [read more...](/reference/basic/show-number)
* **pause** : [read more...](/reference/basic/pause)
## Objectives
* learn how to show a number on the LED screen, one digit at a time
* learn how to pause program execution for the specified number of milliseconds
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Understands that iteration is the repetition of a process such as a loop (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Understands the difference between hardware and application software, and their roles within a computer system (AB)
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/lucky-7/activity)
* [tutorial](/lessons/lucky-7/tutorial)
* [quiz](/lessons/lucky-7/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/lucky-7/challenges)
## Homework
* Extended Activity: [challenges](/lessons/lucky-7/challenges)

Просмотреть файл

@ -1,24 +0,0 @@
# lucky 7 activity
show a number on the LED screen.
### ~avatar avatar
### @video td/videos/lucky-7-0
Let's learn how to show the lucky number 7 on the LED screen.
### ~
We will use `basic->show number` to display a number on the screen. The first argument (`7`) is the number to display and the second argument (`150`) is duration in milliseconds between column scroll. For example, you can reduce `150` to `100` to speed up the scrolling.
```
basic.showNumber(7, 150) // ***
```
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/lucky-7/challenges)!
### ~

Просмотреть файл

@ -1,39 +0,0 @@
# lucky 7 challenges
Coding challenges for the lucky 7 tutorial. #docs
## Before we get started
Complete the [lucky 7](/lessons/lucky-7/activity) activity and your code will look like this:
```
basic.showNumber(7, 150)
```
### Challenge 1
But we also should pause before showing another number. Let's add a pause of 500 milliseconds.
```
basic.showNumber(7, 150)
basic.pause(500) // ***
```
### Challenge 2
### @video td/videos/lucky-7-1-2
What about other multiples of 7? Let's display the next multiple of 7 on the screen!
```
basic.showNumber(7, 150)
basic.pause(500)
basic.showNumber(14, 150) // ***
```
* Run the code to see if it works as expected.
### Challenge 3
Keep displaying multiples of 7 such as 21 and 28, but don't forget to add pauses between the numbers!

Просмотреть файл

@ -1,38 +0,0 @@
# lucky 7 quiz answers
Show a number on the BBC micro:bit.
This is the answer key for the [lucky 7 quiz](/lessons/lucky-7/quiz).
## 1. Describe what `basic->show number` does?
Answers may vary. This will show a number on the LED screen, one digit at a time (scrolling from left to right).
## 2. Draw every LED that is ON after running this code
```
basic.showNumber(7, 150)
```
<br/>
![](/static/mb/lessons/lucky-7-0.png)
## 3. Draw every LED that is ON after running this code
```
basic.showNumber(21, 150)
```
![](/static/mb/lessons/lucky-7-1.png)
## 4. Write the code that will be used to display the number 3 on the BBC micro:bit.
![](/static/mb/lessons/lucky-7-2.png)
<br/>
```
basic.showNumber(3, 150)
```

Просмотреть файл

@ -1,44 +0,0 @@
# lucky 7 quiz
Show a number on the BBC micro:bit.
## Name
## Directions
Use this activity document to guide your work in the [lucky 7 tutorial](/lessons/lucky-7/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. Describe what "basic->show number" does?
<br/>
## 2. Draw every LED that is ON after running this code
```
basic.showNumber(7, 150)
```
![](/static/mb/empty-microbit.png)
<br/>
## 3. Draw every LED that is ON after running this code
```
basic.showNumber(21, 150)
```
![](/static/mb/lessons/answering-machine-4.png)
<br/>
## 4. Write the code that will be used to display the number 3 on the BBC micro:bit.
![](/static/mb/lessons/lucky-7-3.png)
<br/>
<br/>

Просмотреть файл

@ -1,109 +0,0 @@
# magic 8 challenges
Coding challenges for the magic 8 tutorial #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/magic-8-ball/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
basic.clearScreen()
let randomNumber = Math.random(3)
if (randomNumber == 2) {
basic.showString("Yes", 150)
} else if (randomNumber == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 1**
Now let's increase the number of responses the magic 8 ball can give. How about 5 responses instead? Let's change the limit of `math->random` to 5.
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
basic.clearScreen()
let randomNumber1 = Math.random(5) // ***
if (randomNumber1 == 2) {
basic.showString("Yes", 150)
} else if (randomNumber1 == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 2**
Now have the magic 8 ball respond "Try again" if **randomNumber** is 3.
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
basic.clearScreen()
let randomNumber2 = Math.random(5)
if (randomNumber2 == 3) {
basic.showString("Try again", 150) // ***
} else if (randomNumber2 == 2) {
basic.showString("Yes", 150)
}
else if (randomNumber2 == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 3**
Now what about if **randomNumber** is 4? Let's have the magic 8 ball respond "Definitely!".
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
basic.clearScreen()
let randomNumber3 = Math.random(5)
if (randomNumber3 == 4) {
basic.showString("Definitely!", 150) // ***
} else if (randomNumber3 == 3) {
basic.showString("Try again", 150)
}
else if (randomNumber3 == 2) {
basic.showString("Yes", 150)
}
else if (randomNumber3 == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 4**
Add 3 more responses so your magic 8 ball has 8 possible responses. Be creative!

Просмотреть файл

@ -1,102 +0,0 @@
# magic 8 lesson
a fortune teller game with the BBC micro:bit.
### @video td/videos/magic-8-1
## Topic
If (Conditionals)
## Quick Links
* [activity](/lessons/magic-8/activity)
* [quiz](/lessons/magic-8/quiz)
* [quiz answers](/lessons/magic-8/quiz-answers)
* [challenges](/lessons/magic-8/challenges)
* [tutorial](/lessons/magic-8/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to creating **conditionals**, `if condition do` to conditionally run code depending on whether a condition is true or not. We will be learning how to create a fortune telling app using local variable and conditionals (If), input on shake as well as simple commands, such as show string, show number, and clear screen.
## Documentation
* **show string** : [read more...](/reference/basic/show-string)
* **show number** : [read more...](/reference/basic/show-number)
* **on shake** : [read more...](/reference/input/on-gesture)
* **clear screen** : [read more...](/reference/basic/clear-screen)
* **local variable** : [read more...](/reference/variables/var)
* **random number** : [read more...](/js/math)
* **if** : [read more...](/reference/logic/if)
## Objectives
* learn how to show a string on the LED screen
* learn how to show a number on the LED screen
* learn how to learn how to turn off all the LED lights on the LED screen
* learn how to use the input on shake
* learn how to learn how to create a local variable to store data so that you can use it later in your code
* learn how to learn how to return a random number
* learn how to learn how to conditionally run code depending on whether a condition is true or not
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/magic-8/activity)
* [tutorial](/lessons/magic-8/tutorial)
* [quiz](/lessons/magic-8/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/magic-8/challenges)
## Homework
* Extended Activity: [challenges](/lessons/magic-8/challenges)

Просмотреть файл

@ -1,112 +0,0 @@
# magic 8 activity
a fortune teller game on the BBC micro:bit #docs
### ~avatar avatar
Welcome! This tutorial will help you create a magic 8 ball on the BBC micro:bit. Let's get started!
### ~
Show a string to instruct the user how to play Magic 8! The magic 8 ball can only answer true or false questions.
```blocks
basic.showString("Ask a question", 150)
```
Display the number 8.
```blocks
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
```
* Run your program
Register code to run when the BBC micro:bit is shaken.
```blocks
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
})
```
Create a variable of type number called **x**.
Set **x** equal to a random number with a limit of 3.
Remember the random function in the math library, picks a random number from 0 to the limit, but not including the limit unless it is 0.
```blocks
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
let x = Math.random(3)
})
```
Create an if statement for the condition `if x= 2`.
If **x** is 2, display the string 'Yes'
```blocks
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
let x1 = Math.random(3)
if (x1 == 2) {
basic.showString("Yes", 150)
}
})
```
Create an if statement for the condition `if x = 1`.
If ``x`` is 1, display the string 'No'
```blocks
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
let x2 = Math.random(3)
if (x2 == 2) {
basic.showString("Yes", 150)
} else if (x2 == 1) {
basic.showString("No", 150)
}
})
```
If **x** is not 2 or 1, it must be 0. This is the else condition.
If **x** is 0, display the string 'I don't know'
Display the number 8 so users know they can ask the magic 8 ball another question!
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
basic.clearScreen()
let randomNumber = Math.random(3)
if (randomNumber == 2) {
basic.showString("Yes", 150)
} else if (randomNumber == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
* Run your program
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/magic-8/challenges)!
### ~

Просмотреть файл

@ -1,105 +0,0 @@
# magic 8 challenges
Coding challenges for the magic 8 tutorial #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/magic-8-ball/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
let x = Math.random(3)
if (x == 2) {
basic.showString("Yes", 150)
} else if (x == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 1**
Now let's increase the number of responses the magic 8 ball can give. How about 5 responses instead? Let's change the limit of `math->random` to 5.
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
let x1 = Math.random(5) // ***
if (x1 == 2) {
basic.showString("Yes", 150)
} else if (x1 == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 2**
Now have the magic 8 ball respond ``"Try again"`` if ``x`` is 3.
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
let x2 = Math.random(5)
if (x2 == 3) {
basic.showString("Try again", 150) // ***
} else if (x2 == 2) {
basic.showString("Yes", 150)
}
else if (x2 == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 3**
Now what about if ``x`` is 4? Let's have the magic 8 ball respond ``"Definitely!"``.
```
basic.showString("Ask a question", 150)
basic.showNumber(8, 150)
input.onGesture(Gesture.Shake, () => {
let x3 = Math.random(5)
if (x3 == 4) {
basic.showString("Definitely!", 150) // ***
} else if (x3 == 3) {
basic.showString("Try again", 150)
}
else if (x3 == 2) {
basic.showString("Yes", 150)
}
else if (x3 == 1) {
basic.showString("No", 150)
}
else {
basic.showString("I don't know", 150)
}
basic.showNumber(8, 150)
})
```
**Challenge 4**
Add 3 more responses so your magic 8 ball has 8 possible responses. Be creative!

Просмотреть файл

@ -1,84 +0,0 @@
# magic logo lesson
show an image that points up when the logo is up.
### @video td/videos/magic-logo-0
## Topic
On Logo Up
## Quick Links
* [activity](/lessons/magic-logo/activity)
* [quiz](/lessons/magic-logo/quiz)
* [quiz answers](/lessons/magic-logo/quiz-answers)
* [challenges](/lessons/magic-logo/challenges)
* [tutorial](/lessons/magic-logo/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to plot image **on logo up**, `input->on logo up` to run code when the micro:bit screen is facing up and vertically orientated. We will be learning how to plot an image with the input logo up, basic plot image, and input logo down.
## Documentation
```cards
input.onGesture(Gesture.Shake, () => {});
basic.showLeds(``);
```
## Objectives
* learn how to display an image on the micro:bit's LED screen
* learn how to run code when the micro:bit screen is facing down and vertically orientated
* learn how to run code when the micro:bit screen is facing up and vertically orientated
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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)
* Recognises the audience when designing and creating digital content (EV)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/magic-logo/activity)
* [quiz](/lessons/magic-logo/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/magic-logo/challenges)
## Homework
* Extended Activity: [challenges](/lessons/magic-logo/challenges)

Просмотреть файл

@ -1,41 +0,0 @@
# magic logo activity
show an image that points up when the logo is up.
### ~avatar avatar
### @video td/videos/magic-logo-0
Welcome! This tutorial will help you display an arrow pointing toward the logo! Let's get started.
### ~
Using the **accelerometer** sensor, the BBC micro:bit can detect when the **logo** is oriented **up**. We call that the **logo up** event. We will use `input->on logo up` to register an event handler that will run when the **logo up** event happens.
```
input.onLogoUp(() => {
}) // ***
```
When the BBC micro:bit goes logo up, the code nested under the `basic->on logo up` function will run. Let's add a line of code to plot an image in there.
```
input.onLogoUp(() => {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400) // ***
})
```
Run your code and try to turn around the BBC micro:bit to see the **logo up** event in action!
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/magic-logo/challenges)!
### ~

Просмотреть файл

@ -1,55 +0,0 @@
# magic logo challenges
Coding challenges for the magic logo tutorial. #docs
## Before we get started
Complete the [magic logo](/lessons/magic-logo/activity) activity and your code will look like this:
```
input.onLogoUp(() => {
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
```
### Challenge 1
How about when the logo is down? We should display an arrow pointing downward!
### @video td/videos/magic-logo-1-2
```
input.onLogoUp(() => {
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
input.onLogoDown(() => {
basic.plotImage(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`) // ***
}) // ***
```
### Challenge 2
Use the `input->on screen up` event to show a spinning arrow when the screen is turned up.
### Challenge 3
Display another animation using the `input->on screen up` event.

Просмотреть файл

@ -1,75 +0,0 @@
# night light lesson
change the brightness of the BBC micro:bit.
### @video td/videos/night-light-0
## Topic
Set Brightness
## Quick Links
* [activity](/lessons/night-light/activity)
* [quiz](/lessons/night-light/quiz)
* [quiz answers](/lessons/night-light/quiz-answers)
* [challenges](/lessons/night-light/challenges)
* [tutorial](/lessons/night-light/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to **set brightness** of an image `led->set brightness` to set the brightness of the LED screen. We will be learning how to set the brightness of the LED screen using LED plot all, input on button pressed as well as simple commands, such as LED set brightness.
## Documentation
* **set brightness** : [read more...](/reference/led/set-brightness)
* **plot all** : [read more...](/reference/led/plot-all)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
## Objectives
* learn how to set the brightness of the LED screen
* learn how to run code when an input button is pressed
* learn how to turn on all LEDs
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Selects the appropriate data types(AL) (AB
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/night-light/activity)
* [quiz](/lessons/night-light/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/night-light/challenges)
## Homework
* Extended Activity: [challenges](/lessons/night-light/challenges)

Просмотреть файл

@ -1,45 +0,0 @@
# night light activity
change the brightness of the BBC micro:bit.
### ~avatar avatar
### @video td/videos/night-light-0
Welcome! This tutorial will teach you how to change the brightness of the BBC micro:bit. Let's get started!
### ~
The brightness of the LED screen can be changed by using the `led->set brightness` function. This function takes a number between ``0`` (off) and ``255`` (full brightness).
Let's build a little app that dims the screen when pressing button ``A``.
Add the code `led->plot all` to turn on all the LEDs. Don't hesitate to run your code to see what happens.
```
led.plotAll() // ***
```
The screen starts with a 50% brightness value by default (128). Add a new line of code to set the full brightness (255) using `led->set brightness`.
```
led.setBrightness(255) // ***
led.plotAll()
```
Add a new event handler for `input->on button pressed(A)` and add the code to set the brightness to `64`.
```
led.setBrightness(255)
led.plotAll()
input.onButtonPressed(Button.A, () => {
led.setBrightness(64) // ***
}) // ***
```
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/night-light/challenges)!
### ~

Просмотреть файл

@ -1,42 +0,0 @@
# night light challenges
Coding challenges for the night light tutorial. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/night-light/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
led.setBrightness(255)
led.plotAll()
input.onButtonPressed(Button.A, () => {
led.setBrightness(64)
})
```
### Challenge 1
### @video td/videos/night-light-2
What if we want to turn off all the LEDs? Let's do this by setting the brightness to `0` when button `B` is pressed. Add an event handler with `input->on button pressed(B)` add `led->set brightness(0)` to turn off the LEDs.
```
led.setBrightness(255)
led.plotAll()
input.onButtonPressed(Button.A, () => {
led.setBrightness(64)
})
input.onButtonPressed(Button.B, () => {
led.setBrightness(0) // ***
}) // ***
```
**Challenge 3**
Add an event handler with `input->on screen up` to change the LED brightness back to a `255`.
* `Run main` your script to see the LEDs change brightness.

Просмотреть файл

@ -1,137 +0,0 @@
# offset image lesson
shift an image horizontally across the display with offset.
### @video td/videos/offset-image-0
## Topic
**If** Conditionals
## Quick Links
* [tutorial](/lessons/offset-image/tutorial)
* [quiz](/lessons/offset-image/quiz)
* [quiz answers](/lessons/offset-image/quiz-answers)
* [challenges](/lessons/offset-image/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to offset image with a conditional **If**, `if condition then` to run code depending on whether a condition is true or not. We will be learning how to offset image using a local variable, forever loop, the conditional If, input on button pressed, as well as simple commands, such as show string, create image and image show image.
## What the teacher needs to know
* Algorithm: An unambiguous set of rules or a precise step-bystep guide to solve a problem or achieve a particular objective.
* Command: An instruction for the computer to execute, written in a particular programming language.
* Computational thinking: Thinking about systems or problems in a way that allows computer systems to be used to model or solve these.
* Data: A structured set of numbers, possibly representing digitised text, images, sound or video, which can be processed or transmitted by a computer, also used for numerical (quantitative) information.
* Decomposing: The process through which problems or systems are broken down into their component parts, each of which may then be considered separately.
* Hardware: The physical systems and components of digital devices; see also software.
* Loop: A block of code repeated automatically under the programs control.
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
* 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.
* Repetition: Executing a section of computer code a number of times as part of the program.
* Script: A computer program typically executed one line at a time through an interpreter, such as the instructions for a Scratch character.
* Selection: A programming construct in which one section of code or another is executed depending on whether a particular condition is met.
* Sequence: To place program instructions in order, with each executed one after the other.
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
* Variables: A way in which computer programs can store, retrieve or change data, such as a score, the time left, or the users name.
**QuickStart Computing Glossary
## Documentation
* ** global variables ** : [read more...](/js/data)
* ** assignment operator ** : [read more...](/reference/variables/assign)
* ** forever ** : [read more...](/reference/basic/forever)
* ** If ** : [read more...](/reference/logic/if)
* **show string** : [read more...](/reference/basic/show-string)
* **create image** : [read more...](/reference/images/create-image)
* **show image** : [read more...](/reference/images/show-image)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
## Resources
* Activity: [tutorial](/lessons/offset-image/tutorial)
* Activity: [quiz](/lessons/offset-image/quiz)
* Extended Activity: [challenges](/lessons/offset-image/challenges)
## Objectives
* learn how to a create a global variable as a place where you can store and retrieve data, accessible across functions and in nested code blocks
* learn how to set and change the value of a global variable
* learn how to repeat code in the background forever
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show a string on the LED screen
* learn how to create an Image to show on the micro:bit's LED screen
* learn how to show an Image on the micro:bit's LED screen
* learn how to run code when an input button is pressed
## Links to the National Curriculum Programmes of Study for Computing
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Uses post-tested loop e.g.until,and a sequence of selection statements in programs,including an if,then and else statement(AL)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a variable and relational operators within a loop to govern termination (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Uses filters or can perform single criteria searches for information.(AL)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/lessons/offset-image/tutorial)
* [quiz](/lessons/offset-image/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/offset-image/challenges)
## Homework
* Extended Activity: [challenges](/lessons/offset-image/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,80 +0,0 @@
# ornament chain activity
build a telgraph.
# Ornament Chain Activity
![](/static/mb/lessons/ornament-chain-0.jpg)
![](/static/mb/lessons/ornament-chain-1.jpg)
In this project, you will build your ornament chain between BBC micro:bits. Project duration: 15 minutes.
## Materials
* BBC micro:bit, battery holder and 2 AAA batteries
* Crocodile clips
## Steps
### Step 1
![](/static/mb/lessons/banana-keyboard-1.png)
Using the 1st crocodile clip, connect the end of the crocodile clip onto GND pin on the BBC micro:bit.
### Step 2
![](/static/mb/lessons/ornament-chain-2.png)
Using the 2nd crocodile clip, connect the end of the crocodile clip onto the 3V pin on the BBC micro:bit.
### Step 3
![](/static/mb/lessons/ornament-chain-3.png)
Using the 3rd crocodile clip, connect the end of the crocodile clip onto pin 1 of the BBC micro:bit.
### Step 4
![](/static/mb/lessons/ornament-chain-4.png)
Using the 4th crocodile clip, connect the end of the crocodile clip onto pin 2 of the BBC micro:bit.
### Step 5
![](/static/mb/lessons/ornament-chain-5.png)
Using the 1st crocodile clip, connect the unattached end of the crocodile clip onto the GND on the 2nd BBC micro:bit.
### Step 6
![](/static/mb/lessons/ornament-chain-6.png)
Using the 2nd crocodile clip, connect the unattached end of the crocodile clip onto the 3V pin on the 2nd BBC micro:bit.
### Step 7
![](/static/mb/lessons/ornament-chain-7.png)
Using the 3rd crocodile clip, connect the unattached end of the crocodile clip onto pin 2 of the 2nd BBC micro:bit.
### Step 8
![](/static/mb/lessons/ornament-chain-8.png)
Using the 4th crocodile clip, connect the unattached end of the crocodile clip onto pin 1 of the 2nd BBC micro:bit
### Step 9
![](/static/mb/lessons/ornament-chain-0.jpg)
![](/static/mb/lessons/ornament-chain-1.jpg)
Your ornament chain is ready!
### Step 10
* Connect the first BBC micro:bit to your computer using your USB cable and run the [ornament chain](/rnvpgo) script on it.
* Connect the second BBC micro:bit to your computer using your USB cable and run the [ornament chain](/rnvpgo) script on it.
* The first person and second person take turns pressing button A to start the ornament chain game!

Просмотреть файл

@ -1,147 +0,0 @@
# prank wifi app challenges
My script. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/prank-wifi-app/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
basic.showString("Check Wifi", 150)
basic.forever(() => {
let xAccel = math.abs(input.acceleration("x"))
let yAccel = math.abs(input.acceleration("y"))
let zAccel = math.abs(input.acceleration("z"))
let sum = xAccel + yAccel + zAccel
if (sum < 1400) {
basic.plotImage(`
. . . . .
. . . . .
. . # . .
. # # . .
# # # . .
`)
} else if (sum >= 1400 && sum < 1680) {
basic.plotImage(`
. . . . .
. . . # .
. . # # .
. # # # .
# # # # .
`)
}
else if (sum >= 1680) {
basic.plotImage(`
. . . . .
. . . . .
. . . . .
. . . . .
# . . . .
`)
}
})
```
**Challenge 1**
What if wanted to show the maximum connectivity of wifi instead of just 1, 3, or 4 bars?
Let's start by changing the first **IF** statement to `if sum <1200`.
Edit this line: **if** sum <1400 **then**
Just click on the `1400` and backspace until you can add your own number of `1200`.
```
basic.showString("Check Wifi", 150)
basic.forever(() => {
let xAccel1 = math.abs(input.acceleration("x"))
let yAccel1 = math.abs(input.acceleration("y"))
let zAccel1 = math.abs(input.acceleration("z"))
let sum1 = xAccel1 + yAccel1 + zAccel1
if (sum1 < 1200) {
basic.plotImage(`
. . . . .
. . . . .
. . # . .
. # # . .
# # # . .
`)
} else if (sum1 >= 1400 && sum1 < 1680) {
basic.plotImage(`
. . . . .
. . . # .
. . # # .
. # # # .
# # # # .
`)
}
else if (sum1 >= 1680) {
basic.plotImage(`
. . . . .
. . . . .
. . . . .
. . . . .
# . . . .
`)
}
})
```
**Challenge 2**
Let's add an **IF** at the bottom of your code that checks to see if `sum >= to 1200` **and** if `sum <1400`
```
basic.showString("Check Wifi", 150)
basic.forever(() => {
let xAccel2 = math.abs(input.acceleration("x"))
let yAccel2 = math.abs(input.acceleration("y"))
let zAccel2 = math.abs(input.acceleration("z"))
let sum2 = xAccel2 + yAccel2 + zAccel2
if (sum2 < 1200) {
basic.plotImage(`
. . . . .
. . . . .
. . # . .
. # # . .
# # # . .
`)
} else if (sum2 >= 1400 && sum2 < 1680) {
basic.plotImage(`
. . . . .
. . . # .
. . # # .
. # # # .
# # # # .
`)
}
else if (sum2 >= 1680) {
basic.plotImage(`
. . . . .
. . . . .
. . . . .
. . . . .
# . . . .
`)
}
if (sum2 >= 1200 && sum2 < 1400) {
basic.plotImage(`
. . . . #
. . . # #
. . # # #
. # # # #
# # # # #
`) // ***
}
})
```
**Challenge 3**
Now it's your turn! Be creative and change the Wifi meter images to your own wifi image you're sure will prank your friends by editing the lines that call `plot image()`.

Просмотреть файл

@ -1,95 +0,0 @@
# rock paper scissors lesson
a game against the BBC micro:bit.
### @video td/videos/rock-paper-scissors-0
## Topic
Local Variables
## Quick Links
* [activity](/lessons/rock-paper-scissors/activity)
* [challenges](/lessons/rock-paper-scissors/challenges)
* [tutorial](/lessons/rock-paper-scissors/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create a **local variable**, `var t :=time` where you can store data, so that you can use it in your code. We will be learning how to create a classic rock paper scissors game using global variables, input on shake, local variables, math random as well as simple commands such as create image, show image, show string, and show number.
## Documentation
* **on shake** : [read more...](/reference/input/on-gesture)
* **local variable** : [read more...](/reference/variables/var)
* **create image** : [read more...](/reference/images/create-image)
* **math random** : [read more...](/js/math)
* **show image** : [read more...](/reference/images/show-image)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **show string** : [read more...](/reference/basic/show-string)
* **show number** : [read more...](/reference/basic/show-number)
## Objectives
* learn how to create a condition so the micro:bit will run code when it is shaken
* learn how to create a local variable for a place where you can store data
* learn how to create an image to show on the micro:bit's LED screen
* learn how to return a random number
* learn how to show an image on the micro:bit's LED screen
* learn how to run code when an input button is pressed
* learn how to show a string on the LED screen
* learn how to show a number on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Uses filters or can perform single criteria searches for information.(AL)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/rock-paper-scissors/activity)
* [tutorial](/lessons/rock-paper-scissors/tutorial)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/rock-paper-scissors/challenges)
## Homework
* Extended Activity: [challenges](/lessons/rock-paper-scissors/challenges)

Просмотреть файл

@ -1,54 +0,0 @@
# rock paper scissors activity
a game against the BBC micro:bit. #docs
### ~avatar avatar
### @video td/videos/rock-paper-scissors-0
Welcome! This tutorial will help you create a game of rock paper scissors with the BBC micro:bit. Let's get started!
### ~
We want the BBC micro:bit to choose rock, paper, or scissors when it is shaken. Let's begin by creating an `input->on shake` condition so the micro:bit will run code when it is shaken.
```blocks
input.onGesture(Gesture.Shake, () => {
})
```
Next, create an image that contains 3 frames: rock, paper, and scissors. We will control which image is shown with `offset`.
```blocks
input.onGesture(Gesture.Shake, () => {
let img = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . # # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
})
```
The BBC micro:bit will look like it's showing 1 frame of the image by displaying the whole image with plot frame and math random. We can help the BBC micro:bit randomly decide which offset to using plot image by math random. The BBC micro:bit will randomly pick the image to display with plot image and the `math->random(3)` function.
```blocks
input.onGesture(Gesture.Shake, () => {
let img1 = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . # # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
img1.plotFrame(Math.random(3))
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/rock-paper-scissors/challenges)!
### ~

Просмотреть файл

@ -1,70 +0,0 @@
# rock paper scissors challenges
Coding challenges for the rock paper scissors tutorial. #docs
## Before we get started
Complete the following [guided activity](/lessons/rock-paper-scissors/activity) , your code should look like this:
```
input.onGesture(Gesture.Shake, () => {
let img = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . . # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
img.plotFrame(Math.random(3))
})
```
### Challenge 1
When the `A` button is pressed, increment the **score** by ``1``. You can use the `game->add score` function for that.
```
input.onGesture(Gesture.Shake, () => {
let img1 = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . . # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
img1.plotFrame(Math.random(3))
})
input.onButtonPressed(Button.A, () => {
game.addScore(1) // ***
}) // ***
```
### Challenge 2
After incrementing the score, display the total number of wins you have.
```
input.onGesture(Gesture.Shake, () => {
let img2 = images.createImage(`
. . . . . # # # # # . . . . #
. # # # . # . . . # # # . # .
. # # # . # . . . # . . # . .
. # # # . # . . . # # # . # .
. . . . . # # # # # . . . . #
`)
img2.plotFrame(Math.random(3))
})
input.onButtonPressed(Button.A, () => {
game.addScore(1)
basic.showString("WINS: ", 150) // ***
basic.showNumber(game.score(), 150) // ***
})
```
* Run and compile the code to see if it works as expected.
### Challenge 3
You have successfully tracked and displayed the number of wins on the BBC micro:bit! However, what about losses? Use `game->remove life` when button `B` is pressed.
* Run and compile the code to see if it works as expected.

Просмотреть файл

@ -1,12 +0,0 @@
# rotating animation
Create a rotating image with a while loop.
### @video vimeo/134323475
Rotate images with a while loop.
* [tutorial](/lessons/rotation-pattern/tutorial)
* [quiz](/lessons/rotation-animation/quiz)
* [challenges](/lessons/rotation-animation/challenges)
* [lesson plan](/lessons/rotation-animation/lesson-plan)

Просмотреть файл

@ -1,68 +0,0 @@
# rotation animation challenges
These challenges take the rotation animation to the next level by adding a while loop and changing a boolean to false. #docs
**Challenge 0**
### @video vimeo/134323475
The [Rotating Pattern tutorial](https://test.microbit.co.uk/td/lessons/rotation-animation/tutorial) will help you create images that look like a rotating pattern by using a while loop.
```
rotating = true
while (rotating) {
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
}
```
**Challenge 1**
Now let's add to this by creating a condition for on button pressed `A` before the while loop.
```
rotating = true
input.onButtonPressed(Button.A, () => {
}) // ***
while (rotating) {
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
}
```
**Challenge 2**
### @video vimeo/134323896
Now that we have the on button pressed condition, let's make the animation stop rotating by setting the rotating global variable to false when button `A` is pressed.
```
rotating = true
input.onButtonPressed(Button.A, () => {
rotating = false // ***
}) // ***
while (rotating) {
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
}
```
**Challenge 3**
Let's also make the image rotate the opposite way when button A is pressed! We can do this with another while loop that is only executed when `rotating->equals(false)`.

Просмотреть файл

@ -1,99 +0,0 @@
# rotating animation lesson plan
Learn how to create images with a global variable and while loop.
### @video vimeo/134323475
## Topic
While Loop - Rotating Animations
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create images that look like a rotating animation by using a while loop. We will be learning how to create a rotating animation using a global variable, while loop as well as simple commands, such as on button pressed and show animation.
## 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 programs 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
* **global variables**: [read more...](/functions/data)
* **pause**: [read more...](/reference/basic/pause)
* **forever**: [read more...](/reference/basic/forever)
## Resources
* Activity: [tutorial](/lessons/rotating-pattern/tutorial)
* Activity: [quiz](/lessons/rotating-animation/quiz)
* Extended Activity: [challenges](/lessons/rotating-animation/challenges)
## Objectives
* learn how to create a global variable
* learn how a rotating animation
* learn how to repeat the animation
## Links to the National Curriculum Programmes of Study for Computing
## Assessment
### Progression Pathways
### Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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](/lessons/rotating-animation/tutorial)
* [quiz](/lessons/rotating-animation/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/lessons/rotating-animation/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/rotating-animation/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,77 +0,0 @@
# rotating animation quiz
Learn how to create a rotating image with a while loop.
## Name
## Directions
Use this activity document to guide your work in the [rotating animation tutorial](/js/tutorials/rotating-animation).
Answer the questions below while working on or after you finish the tutorial. Pay attention to the dialogs!
## 1. What is a while loop?
## 2. Consider the following directions
Write the code to create a **global variable** called `rotating` and initialize it to **true**.
## 3. Consider the following directions
Write the code to create a **while** loop that will be executed only if the **global variable** called `rotating` is **true**.
## 4. Consider the following code
```
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
```
If the rectangles below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted in the series. Explain why the LED is lighted there.
![](/static/mb/empty-microbit.png)![](/static/mb/empty-microbit.png)![](/static/mb/empty-microbit.png)![](/static/mb/empty-microbit.png)
******************************
## ANSWER KEY
## Directions
Answer the questions below while working on or after you finish the tutorial.
## 2. Consider the following directions
Write the line of code to create a **global variable** called `rotating` and initialize it to **true**.
```
rotating = true
```
## 3. Consider the following directions
Write the line of code that create a **while** loop that will be executed only if the **global variable** called `rotating` is **true**.
```
while (rotating) {
}
```
## 4. Consider the following code
```
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
```
If the rectangles below represents a board that is 5 LEDs wide and 5 LEDs tall, place an X approximately where the LED is lighted in the series. Explain why the LED is lighted there.

Просмотреть файл

@ -1,82 +0,0 @@
# rotation animation lesson
Learn how to create images with a global variable and while loop.
## Topic
While Loop
## Quick links
* [tutorial](/lessons/rotation-animation/tutorial)
* [quiz](/lessons/rotation-animation/quiz)
* [quiz answers](/lessons/rotation-animation/quiz-answers)
* [challenges](/lessons/rotation-animation/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create images that look like a rotating animation by using a while loop. We will be learning how to create a rotating animation using a global variable, while loop as well as simple commands, such as on button pressed and show animation.
## Documentation
* **global variable**: [read more...](/js/data)
* **assignment operator**: [read more...](/reference/variables/assign)
* **while**: [read more...](/js/while)
* **Boolean condition (for the while loop)** : [read more...](/reference/types/boolean)
* **on button pressed**: [read more...](/reference/input/on-button-pressed)
* **show animation**: [read more...](/reference/basic/show-animation)
* **pause**: [read more...](/reference/basic/pause)
## Objectives
* learn how to create a global variable for a place where you can store data, accessible across functions, and in nested code blocks
* learn how to set or change the value of a global variable
* learn how to repeat code while a condition is true
* learn how to declare a global boolean variable to determine which code will execute next
* learn how to run code when an input button is pressed
* learn how to show a series of image frames on the LED screen
* learn how to pause your code for the specified number of milliseconds
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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](/lessons/rotation-animation/tutorial)
* [quiz](/lessons/rotation-animation/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/rotation-animation/challenges)
## Homework
* Extended Activity: [challenges](/lessons/rotation-animation/challenges)

Просмотреть файл

@ -1,75 +0,0 @@
# rotation animation challenges
Coding challenges for the rotation animation tutorial. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/rotation-animation/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
rotating = true
while (rotating) {
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
basic.pause(25)
}
```
### Challenge 1
Now let's add to this by creating a condition for on button pressed `A` before the while loop.
```
rotating = true
input.onButtonPressed(Button.A, () => {
}) // ***
while (rotating) {
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
basic.pause(25)
}
```
### Challenge 2
### @video td/videos/rotation-animation-1-and-2
Now that we have the on button pressed condition, let's make the animation stop rotating by setting the rotating global variable to false when button `A` is pressed.
```
rotating = true
input.onButtonPressed(Button.A, () => {
rotating = false // ***
}) // ***
while (rotating) {
basic.showAnimation(`
# . . . . . . # . . . . . . # . . . . .
. # . . . . . # . . . . . # . . . . . .
. . # . . . . # . . . . # . . # # # # #
. . . # . . . # . . . # . . . . . . . .
. . . . # . . # . . # . . . . . . . . .
`, 400)
basic.pause(25)
}
```
* Run the code to see the awesome rotation.
### Challenge 3
Let's also make the image rotate the opposite way when button A is pressed! We can do this with another while loop that is only executed while `not rotating`.

Просмотреть файл

@ -1,99 +0,0 @@
# rotation animation lesson plan
Learn how to create images with a global variable and while loop.
### @video vimeo/134323475
## Topic
While Loop - Rotating Animations
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create images that look like a rotating animation by using a while loop. We will be learning how to create a rotating animation using a global variable, while loop as well as simple commands, such as on button pressed and show animation.
## 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 programs 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
* **global variables**: [read more...](/js/data)
* **pause**: [read more...](/reference/basic/pause)
* **forever**: [read more...](/reference/basic/forever)
## Resources
* Activity: [tutorial](/lessons/rotation-animation/tutorial)
* Activity: [quiz](/lessons/rotation-animation/quiz)
* Extended Activity: [challenges](/lessons/rotation-animation/challenges)
## Objectives
* learn how to create a global variable
* learn how a rotating animation
* learn how to repeat the animation
## Links to the National Curriculum Programmes of Study for Computing
## Assessment
### Progression Pathways
### Computational Thinking Framework
#### Algorithms
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Declares and assigns variables.(AB)
#### 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](/lessons/rotation-animation/tutorial)
* [quiz](/lessons/rotation-animation/quiz)
* assessment opportunities: forever, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/lessons/rotation-animation/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/rotation-animation/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,109 +0,0 @@
# screen wipe lesson
clear the screen by pressing button "A".
### @video td/videos/screen-wipe-0
## Topic
Clear Screen
## Quick Links
* [activity](/lessons/screen-wipe/activity)
* [quiz](/lessons/screen-wipe/quiz)
* [quiz answers](/lessons/screen-wipe/quiz-answers)
* [challenges](/lessons/screen-wipe/challenges)
* [tutorial](/lessons/screen-wipe/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to **clear screen**, `basic->clear screen` to turn off all the LED lights on the LED screen. We will be learning how to clear all LED lights on the LED screen using clear screen, input on button pressed as well as simple commands, such as show animation.
## What the teacher needs to know/QuickStart Computing Glossary
* Algorithm: An unambiguous set of rules or a precise step-by-step guide to solve a problem or achieve a particular objective.
* Hardware: The physical systems and components of digital devices; see also software.
* Input: Data provided to a computer system, such as via a keyboard, mouse, microphone, camera or physical sensors.
* Output: The information produced by a computer system for its user, typically on a screen, through speakers or on a printer, but possibly through the control of motors in physical systems.
* Programmable toys: Robots designed for children to use, accepting input, storing short sequences of simple instructions and moving according to this stored program.
* Script: A computer program typically executed one line at a time through an interpreter, such as the instructions for a Scratch character.
* Selection: A programming construct in which one section of code or another is executed depending on whether a particular condition is met.
* Simulation: Using a computer to model the state and behaviour of real-world (or imaginary) systems, including physical or social systems; an integral part of most computer games.
## Documentation
* **show animation** : [read more...](/reference/basic/show-animation)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **clear screen** : [read more...](/reference/basic/clear-screen)
## Resources
* Activity: [tutorial](/lessons/screen-wipe/tutorial)
* Activity: [quiz](/lessons/screen-wipe/quiz)
* Extended Activity: [challenges](/lessons/screen-wipe/challenges)
## Objectives
* learn how to show a series of image frames on the LED screen, pausing the specified time after each frame
* learn how to run code when an input button is pressed
* learn how to turn off all the LED lights on the LED screen
## Links to the National Curriculum Programmes of Study for Computing
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Shows an awareness of tasks best completed by humans or computers (EV)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Recognises that different solutions exist for the same problem (AL) (AB) Understands that iteration is the repetition of a process such as a loop (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Selects the appropriate data types(AL) (AB
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, and presents data and information in digital content (AB)
* Recognises ethical issues surrounding the application of information technology beyond school.
* Designs criteria to critically evaluate the quality of solutions, uses the criteria to identify improvements and can make appropriate refinements to the solution (EV)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [tutorial](/lessons/screen-wipe/tutorial)
* [quiz](/lessons/screen-wipe/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/screen-wipe/challenges)
## Homework
* Extended Activity: [challenges](/lessons/screen-wipe/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,87 +0,0 @@
# smiley lesson
design a blinking image lesson #docs
### @video td/videos/smiley-0
## Topic
Show Animation
## Quick Links
* [activity](/lessons/smiley/activity)
* [quiz](/lessons/smiley/quiz)
* [quiz answers](/lessons/smiley/quiz-answers)
* [challenges](/lessons/smiley/challenges)
* [tutorial](/lessons/smiley/tutorial)
## Class
Year 7
## Prior learning / place of lesson in scheme of work
Learn how to **Show LEDs** on the screen. We will be learning show animation, show LEDs and pause.
## Documentation
* **show animation** : [read more...](/reference/basic/show-animation)
* **show LEDs** : [read more...](/reference/basic/show-leds)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
## Objectives
* learn how to show a series of image frames on the LED screen, pausing the specified time after each frame
* learn how to plot an image to show an image on the micro:bit's LED screen
* learn how to run code when an input button is pressed
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
#### Hardware & Processing
* Understands the difference between hardware and application software, and their roles within a computer system (AB)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns (AL)
#### Information Technology
* Collects, organizes, 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](/lessons/smiley/tutorial)
* [quiz](/lessons/smiley/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/smiley/challenges)
## Homework
* Extended Activity: [challenges](/lessons/smiley/challenges)

Просмотреть файл

@ -1,30 +0,0 @@
# smiley activity
Learn to design a blinking image.
### ~avatar avatar
### @video td/videos/smiley-0
Welcome! This tutorial will help you make a smiley face blink. Let's get started!
### ~
Create an animation with a frame displaying a smiley face and the next frame with no LEDs lit up. This will make it look like the smiley face is blinking as the display switches between frames.
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . . . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400) // ***
```
### ~avatar boothing
Excellent, you're ready to continue with the [challenges](/lessons/smiley/challenges)!
### ~

Просмотреть файл

@ -1,67 +0,0 @@
# smiley challenges
Coding challenges for the smiley tutorial. #docs
## Before we get started
Complete the [smiley activity](/lessons/smiley/activity) and your code will look like this:
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . . . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
```
### Challenge 1
What if we want to make the face to frown when button `A` is pressed?
Let's make add code that will run when button `A` is pressed!
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . . . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
input.onButtonPressed(Button.A, () => {
}) // ***
```
### Challenge 2
### @video td/videos/smiley-2
Now, we want to show a frowny face when this button is pressed. Let's plot that image.
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . . . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
input.onButtonPressed(Button.A, () => {
basic.showLeds(`
. # . # .
. # . # .
. . . . .
. # # # .
# . . . #
`, 400) // ***
})
```
* Run your code to see if it works as expected.
### Challenge 3
When button `B` is pressed, let's change the sad face back to a happy face. To do this, begin by adding a condition for `input->on button pressed(B)`. Then show a smiley face inside the condition.

Просмотреть файл

@ -1,76 +0,0 @@
# smiley quiz answers.
This is the answer key for the [smiley quiz](/lessons/smiley/quiz).
## 1. Define 'show animation' :
A function that will show a series of image frames on the LED screen, pausing the specified time after each frame.
## 2. Why is there an extra empty frame after the smiley face?
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
```
<br/>
<br/>
The extra empty frame creates a blinking smiley, allowing the BBC micro:bit to alternate between showing the smiley and the empty screen.
## 3. Change the delay shown from 400 milliseconds to 1000 milliseconds.
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
```
<br/>
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 1000)
```
## 4. Now let's change the delay shown below from 400 milliseconds to 2.5 seconds.
![](/static/mb/lessons/smiley-0.png)
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
```
<br/>
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 2500)
```

Просмотреть файл

@ -1,54 +0,0 @@
# smiley quiz
make a smiley face blink.
## Name
## 1. Describe what `basic->show animation` does
<br/>
<br/>
## 2. Why is there an extra empty frame after the smiley face?
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
```
<br/>
## 3. Change the delay shown from 400 milliseconds to 1000 milliseconds.
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
```
<br/>
## 4. Now let's change the delay shown below from 400 milliseconds to 2.5 seconds.
```
basic.showAnimation(`
. # . # . . . . . .
. # . # . . . . . .
. . # . . . . . . .
# . . . # . . . . .
. # # # . . . . . .
`, 400)
```
<br/>

Просмотреть файл

@ -1,74 +0,0 @@
# snowflake fall lesson
design a blinking rectangle animation.
### @video td/videos/snowflake-fall-0
## Topic
Show Animation
## Quick Links
* [activity](/lessons/snowflake-fall/activity)
* [quiz](/lessons/snowflake-fall/quiz)
* [quiz answers](/lessons/snowflake-fall/quiz-answers)
* [challenges](/lessons/snowflake-fall/challenges)
* [tutorial](/lessons/snowflake-fall/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to create **animation**, `basic->show animation` to display an animated image. We will be learning how to create an animated image using forever loop as well as simple commands, such as show animation.
## Documentation
* **show animation** : [read more...](/reference/basic/show-animation)
* **forever** : [read more...](/reference/basic/forever)
## Objectives
* learn how to show a series of image frames on the LED screen, pausing the specified time after each frame
* learn how to repeat code in the background forever
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses diagrams to express solutions.(AB)
* Represents solutions using a structured notation (AL) (AB)
* Can identify similarities and differences in situations and can use these to solve problems (pattern recognition)(GE)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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.
* [activity](/lessons/snowflake-fall/activity)
* [quiz](/lessons/snowflake-fall/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/snowflake-fall/challenges)
## Homework
* Extended Activity: [challenges](/lessons/snowflake-fall/challenges)

Просмотреть файл

@ -1,41 +0,0 @@
# snowflake fall activity
design a blinking rectangle animation.
### ~avatar avatar
### @video td/videos/snowflake-fall-0
Welcome! This tutorial will teach how design a **snowfall animation**. Let's get started!
### ~
Let's start by creating a `basic->forever` loop that will allow us to repeat the animation code. Any code in the `forever` loop will repeat in the background... forever.
```
basic.forever(() => {
}) // ***
```
The next step is to add `basic->show animation` inside the `forever` loop to repeat an animation.
```
basic.forever(() => {
basic.showAnimation(`
. . . . . . . . . .
. . # . . . . . . .
. # # # . . . . . .
. . # . . . . . . .
. . . . . . . . . .
`, 400) // ***
})
```
Run your code in the simulator or download it to your BBC micro:bit to see what happens!
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/snowflake-fall/challenges)!
### ~

Просмотреть файл

@ -1,64 +0,0 @@
# snowflake fall challenges
Coding challenges for the snowflake fall tutorial. #docs
## Before we get started
Complete the [snowflake fall](/lessons/snowflake-fall/activity) activity and your code will look like this:
```
basic.forever(() => {
basic.showAnimation(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`, 400)
})
```
### Challenge 1
### @video td/videos/snowflake-fall-1
Let's begin creating our falling effect by adding another snowflake with `basic->show animation` that displays a different snowflake pattern after the first one. We need 2 frames in the new animation that display both the first and the second snowflake images.
```
basic.forever(() => {
basic.showAnimation(`
. . . . . . . # . .
. . # . . . # . # .
. # # # . # . . . #
. . # . . . # . # .
. . . . . . . # . .
`, 400) // ***
})
```
* Run your program to see the cool animation.
### Challenge 2
### @video td/videos/snowflake-fall-2
To finalize our snowflake fall, let's add a different snowflake pattern.
```
basic.forever(() => {
basic.showAnimation(`
. . . . . . . # . . . # . # .
. . # . . . # . # . # # . # #
. # # # . # . . . # . . . . .
. . # . . . # . # . # # . # #
. . . . . . . # . . . # . # .
`, 400) // ***
})
```
* Run your program and see if it works.
### Challenge 3
Add a fourth frame to the current animation... or make it your own!

Просмотреть файл

@ -1,70 +0,0 @@
# snowflake fall quiz answers
create a snowflake fall animation.
## Name
## Directions
Use this activity document to guide your work in the [snowflake fall tutorial](/lessons/snowflake-fall/tutorial).
Answer the questions while completing the tutorial. Pay attention to the dialogues!
## 1. In reference to an animation, what is an "interval"?
The number of milliseconds to pause after each image frame.
## 2. Consider the following code
```
basic.showAnimation(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`, 400)
```
What is the `interval` of the animation?
400
## 3. Consider the following image
![](/static/mb/lessons/snowflake-fall-0.png)
Write the code to create a `forever` loop that shows an animation. Change the interval from 400 to 200 to make the animation go twice as fast!
```
basic.forever(() => {
basic.showAnimation(`
. . . . . . . . . .
. . # . . . . . . .
. # # # . . . . . .
. . # . . . . . . .
. . . . . . . . . .
`, 200)
})
```
## 4. Consider the following images
![](/static/mb/lessons/snowflake-fall-1.png)
![](/static/mb/lessons/snowflake-fall-2.png)
Write the code to create a `forever` loop that shows an animation. Change the interval from 400 to 800 to make the animation go twice as slow!
```
basic.forever(() => {
basic.showAnimation(`
. . . . . # # # # #
. . # . . # # . # #
. # # # . # . # . #
. . # . . # # . # #
. . . . . # # # # #
`, 800)
})
```

Просмотреть файл

@ -1,56 +0,0 @@
# snowflake fall quiz answers
create a snowflake fall animation.
This is the answer key for the [snowflake fall quiz](/lessons/snowflake-fall/quiz).
## 1. In reference to an animation, what is an "interval"?
The number of milliseconds to pause after each image frame.
## 2. What is the interval of the animation?
```
basic.showAnimation(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`, 400)
```
## 3. Write the code to allow this animation to never stop displaying on the BBC micro:bit
![](/static/mb/lessons/snowflake-fall-0.png)
```
basic.forever(() => {
basic.showAnimation(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`, 400)
})
```
## 4. Write the code to create a forever loop that shows an animation of these images. Change the interval from 400 to 800 to make the animation go twice as slow!
![](/static/mb/lessons/snowflake-fall-1.png)
![](/static/mb/lessons/snowflake-fall-2.png)
```
basic.forever(() => {
basic.showAnimation(`
. . . . . # # # # #
. . # . . # # . # #
. # # # . # . # . #
. . # . . # # . # #
. . . . . # # # # #
`, 800)
})
```

Просмотреть файл

@ -1,42 +0,0 @@
# snowflake fall quiz
create a snowflake fall animation.
## Name
## Directions
Use the hints in the [snowflake fall activity](/lessons/snowflake-fall/activity) to answer this quiz!
## 1. In reference to an animation, what is an "interval"?
<br />
## 2. What is the interval of the animation?
```
basic.showAnimation(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`, 400)
```
<br/>
## 3. How can we make this animation never stop displaying on the BBC micro:bit?
![](/static/mb/lessons/snowflake-fall-0.png)
<br/>
## 4. Write the code to create a forever loop that shows an animation of these images. Change the interval from 400 to 800 to make the animation go twice as slow!
![](/static/mb/lessons/snowflake-fall-1.png)
![](/static/mb/lessons/snowflake-fall-2.png)
<br/>

Просмотреть файл

@ -1,96 +0,0 @@
# spinner lesson
a spin the BBC micro:bit game with the input on shake.
## Topic
If (Conditionals)
## Quick Links
* [activity](/lessons/spinner/activity)
* [challenges](/lessons/spinner/challenges)
* [quiz](/lessons/spinner/quiz)
* [quiz answers](/lessons/spinner/quiz-answers)
* [tutorial](/lessons/spinner/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to use an if statement **if condition do** to run code run code depending on whether a condition is true or not. We will be learning how to create a die with if statements, input on shake, a local variable, assignment operator, math random as well as simple commands such as plot image.
## Documentation
* **on shake** : [read more...](/reference/input/on-gesture)
* **variable** : [read more...](/reference/variables/var)
* **assignment operator** : [read more...](/reference/variables/assignment)
* **math random** : [read more...](/js/math)
* **If** : [read more...](/reference/logic/if)
* **show LEDs** : [read more...](/reference/basic/show-leds)
## Objectives
* learn how to run code when the BBC micro:bit is shaken, when running code in the web browser, moving the mouse quickly simulates shaking
* learn how to create a local variable as a place where you can store and retrieve data
* learn how the assignment operator is used to declare a new local variable
* learn how to declare a new local variable or update the value of a variable
* learn how to return a random number
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show an image on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Data & Data Representation
* Understands the difference between data and information(AB)
* Uses filters or can perform single criteria searches for information.(AL)
* Performs more complex searches for information e.g. using Boolean and relational operators(AL) (GE) (EV)
* Defines data types: real numbers and Boolean (AB)
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Makes appropriate improvements to solutions based on feedback received, and can comment on the success of the solution (EV)
* Makes judgements about digital content when evaluating and repurposing it for a given audience (EV) (GE)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/spinner/activity)
* [tutorial](/lessons/spinner/tutorial)
* [quiz](/lessons/spinner/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/spinner/challenges)
## Homework
* Extended Activity: [challenges](/lessons/spinner/challenges)

Просмотреть файл

@ -1,85 +0,0 @@
# spinner activity
create an arrow that randomly points to a player. #docs
Let's begin by adding an `input->on shake` condition to know when the BBC micro:bit is shaken.
```
input.onGesture(Gesture.Shake, () => {
})
```
Now let's randomly generate a number from 0 to 3 so that we can randomly display an arrow in a given direction.
```
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(4)
})
```
Now let's handle each of the cases by displaying the appropriate arrow. (Let's display an up arrow if `random arrow` is 0.
```
input.onGesture(Gesture.Shake, () => {
let randomArrow1 = Math.random(4)
if (randomArrow1 == 0) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
}
})
```
Now let's handle the rest of the cases for `random arrow`.
```
input.onGesture(Gesture.Shake, () => {
let randomArrow2 = Math.random(4)
if (randomArrow2 == 0) {
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
} else if (randomArrow2 == 1) {
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`, 400)
}
else if (randomArrow2 == 2) {
basic.showLeds(`
. . # . .
. . # # .
# # # # #
. . # # .
. . # . .
`, 400)
}
else if (randomArrow2 == 3) {
basic.showLeds(`
. . # . .
. # # . .
# # # # #
. # # . .
. . # . .
`, 400)
}
})
```
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/spinner/challenges)!
### ~

Просмотреть файл

@ -1,156 +0,0 @@
# spinner challenges
create an arrow that randomly points to a player. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/spinner/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
input.onGesture(Gesture.Shake, () => {
let randomArrow = Math.random(4)
if (randomArrow == 0) {
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
}
if (randomArrow == 1) {
basic.plotImage(`
. . # . .
. . # . .
# # # # #
. # # # .
. . # . .
`)
}
if (randomArrow == 2) {
basic.plotImage(`
. . # . .
. . # # .
# # # # #
. . # # .
. . # . .
`)
}
if (randomArrow == 3) {
basic.plotImage(`
. . # . .
. # # . .
# # # # #
. # # . .
. . # . .
`)
}
})
```
### Challenge 1
Modify the random number generator so that it can include new arrows we will create in the next challenge.
```
input.onGesture(Gesture.Shake, () => {
let randomArrow1 = Math.random(8) // ***
// **. . .**
if (randomArrow1 == 4) {
basic.plotImage(`
# # # # .
# # # . .
# # # . .
# . . # .
. . . . #
`)
}
if (randomArrow1 == 5) {
basic.plotImage(`
. # # # #
. . # # #
. . # # #
. # . # #
# . . . .
`)
}
if (randomArrow1 == 6) {
basic.plotImage(`
# . . . .
. # . . #
. . # # #
. . # # #
. # # # #
`)
}
if (randomArrow1 == 7) {
basic.plotImage(`
. . . . #
# . . # .
# # # . .
# # # . .
# # # # .
`)
}
})
```
* Do **not** run the code yet because it will not work until you have conditions for every random number.
### Challenge 2
Let's add four more arrows that point diagonally.
```
input.onGesture(Gesture.Shake, () => {
let randomArrow2 = Math.random(4)
// **. . .**
if (randomArrow2 == 4) {
basic.plotImage(`
# # # # .
# # # . .
# # # . .
# . . # .
. . . . #
`) // ***
}
if (randomArrow2 == 5) {
basic.plotImage(`
. # # # #
. . # # #
. . # # #
. # . # #
# . . . .
`) // ***
}
if (randomArrow2 == 6) {
basic.plotImage(`
# . . . .
. # . . #
. . # # #
. . # # #
. # # # #
`) // ***
}
if (randomArrow2 == 7) {
basic.plotImage(`
. . . . #
# . . # .
# # # . .
# # # . .
# # # # .
`) // ***
}
})
```
* Run your code to see if it works as expected
### Challenge 3
Add some other arrows if there are more than 8 players.

Просмотреть файл

@ -1,76 +0,0 @@
# strobe light lesson
Learn how to create a blinking LED script.
### @video td/videos/strobe-light-0
## Topic
For Loop
## Quick links
* [tutorial](/lessons/strobe-light/tutorial)
* [quiz](/lessons/strobe-light/quiz)
* [quiz answers](/lessons/strobe-light/quiz-answers)
* [challenges](/lessons/strobe-light/challenges)
## Class
Year 7
## Documentation
* **for loop**: [read more...](/reference/loops/for)
* **plot**: [read more...](/reference/led/plot)
* **unplot**: [read more...](/reference/led/unplot)
* **pause**: [read more...](/reference/basic/pause)
## Objectives
* learn how to repeat code a fixed number of times
* learn how to turn on a LED light on the LED screen. Specify with LED using x, y coordinates
* learn how to turn off a LED light on the LED screen. Specify which LED which x, y coordinates
* learn how to pause program execution for the specified number of milliseconds
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses logical reasoning to predict outputs, showing an awareness of inputs. (AL)
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Uses a variable and relational operators within a loop to govern termination. (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (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: 10 min.
* [tutorial](/lessons/strobe-light/tutorial)
* [quiz](/lessons/strobe-light/quiz)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/strobe-light/challenges)
## Homework
* Extended Activity: [challenges](/lessons/strobe-light/challenges)

Просмотреть файл

@ -1,76 +0,0 @@
# strobe light challenges
Coding challenges for the strobe light tutorial. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/strobe-light/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
led.plot(i, j)
basic.pause(200)
}
}
```
### Challenge 1
### @video td/videos/strobe-light-1
Make the LEDs light up faster by changing the **pause** from 200 to 100 milliseconds:
```
for (let i1 = 0; i1 < 5; i1++) {
for (let j1 = 0; j1 < 5; j1++) {
led.plot(i1, j1)
basic.pause(100) // ***
}
}
```
* Run the code to see if it works as expected.
### Challenge 2
### @video td/videos/strobe-light-2
Make the board light up by rows instead of by columns by swapping the `i` and `j` variables in `led->plot(i, j)`.
```
for (let i2 = 0; i2 < 5; i2++) {
for (let j2 = 0; j2 < 5; j2++) {
led.plot(j2, i2) // ***
basic.pause(100)
}
}
```
* Run the code to see if it works as expected.
### Challenge 3
### @video td/videos/strobe-light-ultimate
Now that all the LEDs are lit up, let's make them turn off by reversing the strobe light pattern! You can use `led->unplot` to turn off a single LED.
```
for (let i3 = 0; i3 < 5; i3++) {
for (let j3 = 0; j3 < 5; j3++) {
led.plot(j3, i3)
basic.pause(100)
}
}
for (let k = 0; k < 5; k++) {
for (let l = 0; l < 5; l++) {
led.unplot(4 - l, 4 - k) // ***
basic.pause(100) // ***
}
}
```

Просмотреть файл

@ -1,100 +0,0 @@
# strobe light lesson plan
Learn how to create a blinking LED script.
## Topic
For loop - Blinking LED
## 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 the for loop as well as simple commands, such as plot and pause.
## 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 programs control. ** The blink program introduces a While Loop. While Loop is a while loop that will repeat code forever while - true.
**Command:** An instruction for the computer to execute, written in a particular programming language.**
**QuickStart Computing Glossary
## Documentation
* **plot**: [read more...](/reference/led/plot)
* **pause**: [read more...](/reference/basic/pause)
* **for loop**: [read more...](/reference/loops/for)
## Resources
* Activity: [tutorial](/lessons/strobe-light/tutorial)
* Activity: [quiz](/lessons/strobe-light/quiz)
* Extended Activity: [challenges](/lessons/strobe-light/challenges)
## Objectives
* learn how to blink a light
* create a for loop that will loop through each x-value, y-value from 0 to 4.
* learn how to pause 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
## Assessment
**Progression Pathways:**
**Computational Thinking Framework:**
#### Algorithms
* Uses logical reasoning to predict outputs, showing an awareness of inputs. (AL)
* Understands that iteration is the repetition of a process such as a loop. (AL)
* Represents solutions using a structured notation. (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals. (AL)
* Uses a variable and relational operators within a loop to govern termination. (AL) (GE)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (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: 10 min.
* [tutorial](/lessons/strobe-light/tutorial)
* [quiz](/lessons/strobe-light/quiz)
* assessment opportunities: loops, plot, pause, clear screen
## Extended Activity
* time: 20 min.
* [challenges](/lessons/strobe-light/challenges)
* assessment opportunities: loops, plot, pause, clear screen
## Homework
* Extended Activity: [challenges](/lessons/strobe-light/challenges)
## Intended follow on
Publish script to the classroom.

Просмотреть файл

@ -1,78 +0,0 @@
# Teach
Overview of Touch Develop lesson instructions for the BBC micro:bit.
### @short Teach
The [lessons](/lessonss) promote computational thinking and computer science literacy from an early age and provide opportunities for learning these skills within the context of public and private education, where they will be available to Year 7 students. This page is a 'how to manual' for using the lessons in the classroom.
### @section full
## Summary
The [lessons](/lessonss) promote computational thinking and computer science literacy from an early age and provide opportunities for learning these skills within the context of public education, where they will be available to Year 7 students. You will find comprehensive teacher training and preparation (lesson plans, videos, guided tutorials, quiz, challenges, and quiz answers). The curriculum has been organized for students from Beginner to Advanced lessons in an effort to build student confidence with computational thinking and coding concepts. The lesson has been constructed with a teacher lesson plan, video(s), tutorial, quiz, challenges, and quiz answers to demonstrate mastery with the Progression Pathways and Computational Thinking Framework. The lesson should occur on-site during a single instructional block.
## Lesson Resources
1) Lesson Plan
The lesson plan maps to the Progressions Pathways, Computing Curriculum, and QuickStart Computing Glossary. The lesson plan explains the concepts being taught for computational thinking while supporting your classroom instruction. A lesson plan also contains Quick Links to the lesson's tutorial, challenges, quiz, and quiz answers as shown in the [blink lesson plan](/lessons/blink).
2) Tutorial
Expand your knowledge of programming with lots of great step-by-step tutorials. All the lessons come with interactive step-by-step tutorials that will drive the students to a complete, functional code. These tutorials are very directive to make sure that students keep progressing. When the tutorials are over, additional challenges are given to advance code through printed instructions. Tutorials contain supporting videos as shown with the [blink tutorial](/lessons/blink/tutorial).
### @video td/videos/blink-0
3) Quiz
Expand your knowledge of computational thinking and computer science literacy with lots of great quizzes. All the tutorials come with quiz questions that will encourage the students to process and evaluate the concepts being introduced throughout the lesson. The quiz questions are mapped to the concepts being introduced in the lesson to make sure that students understand the computer science concepts. Quizzes apply the concepts taught in the tutorial as shown with the [blink quiz](/lessons/blink/quiz).
4) Quiz Answers
The quiz answers provide responses to the quiz. This will allow teachers to accurately review and grade student responses. Please review a sample of the quiz answers provided with the [blink quiz answers](/lessons/blink/quiz-answers).
5) Challenges
After the student completes the quiz, tutorial, and compiles the code onto the BBC micro:bit, distribute the lessons challenges. Challenges are additional customising and exercises for the students. Challenges reinforce the concepts followed in the tutorial and quiz responses as shown with the [blink challenges](/lessons/blink/challenges).
## Teacher Directions
1) Teacher select a lesson from the [lessons](/lessonss)
2) Print the quiz and the challenges for each student
3) Print the quiz answers from you
4) Distribute the printed quiz for every student
5) Complete quiz questions by following the the guided tutorials
6) Compile the code from the tutorial onto the BBC micro:bit
7) Distribute the challenges for additional coding through paper instructions
## Teacher Supplies
1) Print: Lesson Quiz (1 copy per student)
2) Print: Lesson Challenge (1 copy per student)
## Lesson Timeline
``00:00`` Introduce Lesson Objectives (as mentioned in the lesson plan)
``05:00`` Distribute Lesson Quiz
``07:00`` Access BBC micro:bit website
``10:00`` Start Lesson Tutorial & Lesson Quiz
``30:00`` Finish Lesson Tutorial & Lesson Quiz
``35:00`` Start Lesson Challenges
``55:00`` Finish Lesson
``60:00`` Homework: Complete Challenges

Просмотреть файл

@ -1,25 +0,0 @@
# telegraph lesson
display beautiful images on the BBC micro:bit.
## Topic
Telegraph
## Quick Links
* [activity](/lessons/telegraph/activity)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to convert your BBC micro:bit into a telegraph using a second BBC micro:bit as well as pin P1, P2, 3V, GND, and crocodile clips (or spring clips). The connect BBC micro:bit uses pins P1, P2, 3V, GND.
## Objectives
* learn how to setup the BBC micro:bit with crocodile clips
* learn how to telegraph to another BBC micro:bit

Просмотреть файл

@ -1,76 +0,0 @@
# telegraph activity
build a telgraph.
# BBC micro:bit telegraph
![](/static/mb/lessons/telegraph-0.png)
In this project, you will build your telegraph between BBC micro:bits. Project duration: 15 minutes.
## Materials
* BBC micro:bit, battery holder and 2 AAA batteries
* Crocodile clips
## Steps
### Step 1
![](/static/mb/lessons/banana-keyboard-1.png)
Using the 1st crocodile clip, connect the end of the crocodile clip onto GND pin on the BBC micro:bit.
### Step 2
![](/static/mb/lessons/ornament-chain-2.png)
Using the 2nd crocodile clip, connect the end of the crocodile clip onto the 3V pin on the BBC micro:bit.
### Step 3
![](/static/mb/lessons/ornament-chain-3.png)
Using the 3rd crocodile clip, connect the end of the crocodile clip onto pin 1 of the BBC micro:bit.
### Step 4
![](/static/mb/lessons/ornament-chain-4.png)
Using the 4th crocodile clip, connect the end of the crocodile clip onto pin 2 of the BBC micro:bit.
### Step 5
![](/static/mb/lessons/ornament-chain-5.png)
Using the 1st crocodile clip, connect the unattached end of the crocodile clip onto the GND on the 2nd BBC micro:bit.
### Step 6
![](/static/mb/lessons/ornament-chain-6.png)
Using the 2nd crocodile clip, connect the unattached end of the crocodile clip onto the 3V pin on the 2nd BBC micro:bit.
### Step 7
![](/static/mb/lessons/ornament-chain-7.png)
Using the 3rd crocodile clip, connect the unattached end of the crocodile clip onto pin 2 of the 2nd BBC micro:bit.
### Step 8
![](/static/mb/lessons/ornament-chain-8.png)
Using the 4th crocodile clip, connect the unattached end of the crocodile clip onto pin 1 of the 2nd BBC micro:bit
### Step 9
![](/static/mb/lessons/telegraph-0.png)
Your telegraph is ready!
### Step 10
* Connect the first BBC micro:bit to your computer using your USB cable and run the [telegraph](/xvmxti) script on it.
* Connect the second BBC micro:bit to your computer using your USB cable and run the [telegraph](/xvmxti) script on it.
* The first person and second person take turns pressing button A to play the telegraph game!

Просмотреть файл

@ -1,77 +0,0 @@
# temperature lesson
measure the temperature on the BBC micro:bit.
## Topic
Temperature
## Quick Links
* [activity](/lessons/temperature/activity)
* [challenges](/lessons/temperature/challenges)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to get the ambient temperature (degree Celsius °C). The temperature is inferred from the the surface temperature of the various chips on the micro:bit. We will be learning how to get the temperature using on shake, local variables, as well as simple commands such as show number.
## Documentation
* **on shake** : [read more...](/reference/input/on-gesture)
* **local variable** : [read more...](/reference/variables/var)
* **temperature** : [read more...](/reference/input/temperature)
* **show number** : [read more...](/reference/basic/show-number)
* **show string** : [read more...](/reference/basic/show-string)
## Objectives
* learn how to create a variable to store data
* learn how to get the ambient temperature (degree Celsius °C). The temperature is inferred from the the surface temperature of the various chips on the micro:bit.
* learn how to show a number on the LED screen
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Recognises that different algorithms exist for the same problem (AL) (GE)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Selects the appropriate data types(AL) (AB
#### Communication Networks
* Demonstrates responsible use of technologies and online services, and knows a range of ways to report concerns Understands how search engines rank search results (AL)
#### Information Technology
* Collects, organizes, 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)
* Recognises ethical issues surrounding the application of information technology beyond school.
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/temperature/activity)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/temperature/challenges)
## Homework
* Extended Activity: [challenges](/lessons/temperature/challenges)

Просмотреть файл

@ -1,26 +0,0 @@
# the watch lesson
display beautiful images on the BBC micro:bit.
![](/static/mb/lessons/the-watch-0.png)
## Topic
The Watch
## Quick Links
* [activity](/lessons/the-watch/activity)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to design the BBC micro:bit watch with household supplies.
## Objectives
* learn how to design and make the watch with the BBC micro:bit

Просмотреть файл

@ -1,156 +0,0 @@
# The watch activity
control images with variables.
# BBC micro:bit watch
![](/static/mb/lessons/the-watch-0.png)
In this project, you will build your own wearable BBC micro:bit watch from an old pair of jeans and T-shirt. Project duration: 15 minutes.
![](/static/mb/lessons/the-watch-1.png)
## Materials
* BBC micro:bit, battery holder and 2 AAA batteries
* Old T-shirt
* Old Jeans
* Velcro with sticky back – 5cm x 5cm
* Double-sided tape – 22cm x 5cm. You can find carpet tape in your local hardware shop
* Ruler and pen
* Scissors
![](/static/mb/lessons/the-watch-2.png)
## Steps
### Step 1
![](/static/mb/lessons/the-watch-3.png)
Using the ruler and pen, mark a rectangle of more or less 26cm x 5cm on the T-shirt. Dont worry if you dont get it quite right, well tidy things up later on.
### Step 2
![](/static/mb/lessons/the-watch-4.png)
Cut the rectangle using the scissors. Dont worry about the quality of the cut, well trim it later on.
### Step 3
![](/static/mb/lessons/the-watch-5.png)
Cut a piece of cloth from the pair of jeans. Cut straight by the seam.
![](/static/mb/lessons/the-watch-6.png)
### Step 4
![](/static/mb/lessons/the-watch-7.png)
Using the ruler and pen, mark a rectangle of 22cm x 5cm (adults should use 24cm x 5cm) on the jeans cloth.
### Step 5
![](/static/mb/lessons/the-watch-8.png)
Stretch the cloth using your hands and apply the double-side tape on the rectangle marked on the jeans. You might need the help of a friend to achieve this step. Dont worry if the tape is larger than the rectangle, we will trim it later. Make sure to apply pressure to the tape to secure it firmly.
### Step 6
![](/static/mb/lessons/the-watch-9.png)
Using the scissors, cut the rectangle of jeans.
### Step 7
![](/static/mb/lessons/the-watch-10.png)
Peal the tape protective layer from the rectangle.
### Step 8
![](/static/mb/lessons/the-watch-11.png)
Place the BBC micro:bit pins on the tape at more or less **7** cm from the left border. Then lower the BBC micro:bit on the tape and press **gently**.
### Step 9
![](/static/mb/lessons/the-watch-12.png)
Connect the battery holder and place it on the right of the BBC micro:bit. Tuck the cables away on the tape to protect them.
### Step 10
![](/static/mb/lessons/the-watch-13.png)
Stick the T-shirt rectangle from the top of the BBC micro:bit, over the battery cables.
### Step 11
![](/static/mb/lessons/the-watch-14.png)
Use your fingers to push the T-shirt cloth under the BBC micro:bit to give access to the micro-USB plug.
### Step 12
![](/static/mb/lessons/the-watch-15.png)
Place the T-shirt over the battery holder and stick it up to the end.
### Step 13
![](/static/mb/lessons/the-watch-16.png)
Turn over the watch and cut the extra T-shirt material.
### Step 14
![](/static/mb/lessons/the-watch-17.png)
Stick the T-shirt cloth on the other side of the watch. Lift the BBC micro:bit pins to slide the cloth under and leave them free from the tape.
### Step 15
![](/static/mb/lessons/the-watch-18.png)
Turn over the watch and cut left over T-shirt cloth.
### Step 16
![](/static/mb/lessons/the-watch-19.png)
Cut a 5cm x 5cm square of Velcro **loops**.
### Step 17
![](/static/mb/lessons/the-watch-20.png)
Cut a 5cm x 5cm square of Velcro **hooks**.
### Step 18
![](/static/mb/lessons/the-watch-21.png)
Stick the Velcro hooks on the right side of the battery holder on the T-shirt cloth.
### Step 19
![](/static/mb/lessons/the-watch-22.png)
Stick the Velcro loops on the other end on the jeans fabric.
### Step 20
Trim any leftover fabric, threads or tape.
### Step 21
![](/static/mb/lessons/the-watch-23.png)
Your watch is ready!
### Acknowledgements
Artistic design by Melinda Hoeneisen.

Просмотреть файл

@ -1,83 +0,0 @@
# truth or dare lesson
create a love meter with the BBC micro:bit.
## Topic
If (Conditionals)
## Quick Links
* [activity](/lessons/truth-or-dare/activity)
* [challenges](/lessons/truth-or-dare/challenges)
* [quiz](/lessons/truth-or-dare/quiz)
* [quiz answers](/lessons/truth-or-dare/quiz-answers)
* [tutorial](/lessons/truth-or-dare/tutorial)
## Class
Year 7
## Prior learning/place of lesson in scheme of work
Learn how to use an if statement to run code run code depending on whether a condition is true or not. We will be learning how to create the game truth or dare using input an if statement, a local variable, math random as well as simple commands, such as show string and plot image.
## Documentation
* **show LEDs** : [read more...](/reference/basic/show-leds)
* **on button pressed** : [read more...](/reference/input/on-button-pressed)
* **local variable** : [read more...](/reference/variables/var)
* **assignment operator** : [read more...](/reference/variables/assignment)
* **math random** : [read more...](/js/math)
* **If** : [read more...](/reference/logic/if)
* **show string** : [read more...](/reference/basic/show-string)
## Objectives
* learn how to display an image on the BBC micro:bit
* learn how to run code when an input button is pressed
* learn how to a create a variable for a place where you can store and retrieve data
* learn how to declare a new local variable or update the value of a variable
* learn how to return a random number
* learn how to conditionally run code depending on whether a condition is true or not
* learn how to show a string on the LED screen one character at a time (scrolling from left to right)
## Progression Pathways / Computational Thinking Framework
#### Algorithms
* Designs solutions (algorithms) that use repetition and two-way selection, ie if, then and else.(AL)
* Uses diagrams to express solutions.(AB)
* Uses logical reasoning to predict outputs, showing an awareness of inputs (AL)
* Designs solutions by decomposing a problem and creates a sub-solution for each of these parts. (DE) (AL) (AB)
* Represents solutions using a structured notation (AL) (AB)
#### Programming & Development
* Creates programs that implement algorithms to achieve given goals (AL)
* Declares and assigns variables(AB)
* Understands the difference between, and appropriately uses if and if, then and else statements(AL)
* Uses a range of operators and expressions e.g. Boolean, and applies them in the context of program control. (AL)
* Selects the appropriate data types(AL) (AB
#### Hardware & Processing
* Knows that computers collect data from various input devices, including sensors and application software (AB)
Computational Thinking Concept: AB = Abstraction; DE = Decomposition; AL = Algorithmic Thinking; EV = Evaluation; GE = Generalisation
## Activity
* time: 20 min.
* [activity](/lessons/truth-or-dare/activity)
* [tutorial](/lessons/truth-or-dare/tutorial)
## Extended Activity
* time: 20 min.
* [challenges](/lessons/truth-or-dare/challenges)
## Homework
* Extended Activity: [challenges](/lessons/truth-or-dare/challenges)

Просмотреть файл

@ -1,104 +0,0 @@
# truth or dare activity
a multi-player game that forces each player to reveal a secret or something funny. #docs
Begin by plotting an "up-arrow" image, which will point to someone.
```
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
```
* Run your program and look at the arrow!
Now let's create a condition to know when button `A` is pressed so that we can display "truth" or "dare" on the BBC micro:bit.
```
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
input.onButtonPressed(Button.A, () => {
})
```
We want the BBC micro:bit to randomly choose whether to display "truth" or display "dare". We can use accomplish this by using `math->random(2)`.
```
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
input.onButtonPressed(Button.A, () => {
let random = Math.random(2)
})
```
Now let's display the appropriate message for each scenario of `random`.
```
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
input.onButtonPressed(Button.A, () => {
let random1 = Math.random(2)
if (random1 == 0) {
basic.showString("TRUTH", 150)
} else {
basic.showString("DARE", 150)
}
})
```
* Run your program: Press button A!
Notice how the arrow didn't display again after pressing button `A`. Let's add a line of code that displays the arrow again.
```
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
input.onButtonPressed(Button.A, () => {
let random2 = Math.random(2)
if (random2 == 0) {
basic.showString("TRUTH", 150)
} else {
basic.showString("DARE", 150)
}
basic.showLeds(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`, 400)
})
```
* Run your program: Press button A!
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/lessons/truth-or-dare/challenges)!
### ~

Просмотреть файл

@ -1,104 +0,0 @@
# truth or dare challenges
a multi-player game that forces each player to reveal a secret or something funny. #docs
## Before we get started
Complete the following guided tutorial:
* [tutorial](/lessons/truth-or-dare/tutorial)
At the end of the tutorial, click `keep editing`. Your code should look like this:
```
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
input.onButtonPressed(Button.A, () => {
let random = Math.random(2)
if (random == 0) {
basic.showString("TRUTH", 150)
} else {
basic.showString("DARE", 150)
}
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
```
### Challenge 1
Let's make the word "DARE" appear a little more often than "TRUTH". Change the line of code with `math->random(2)` to `math->random(3)`.
```
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
input.onButtonPressed(Button.A, () => {
let random1 = Math.random(3) // ***
if (random1 == 0) {
basic.showString("TRUTH", 150)
} else {
basic.showString("DARE", 150)
}
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
```
### Challenge 2
Instead of just saying "TRUTH" or "DARE", let's sometimes say "SKIP". This would allow the skipped person to spin the BBC micro:bit without completing a truth or dare. Modify the if statement as shown.
```
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
input.onButtonPressed(Button.A, () => {
let random2 = Math.random(3)
if (random2 == 0) {
basic.showString("TRUTH", 150) // ***
} else if (random2 == 1) {
basic.showString("DARE", 150) // ***
}
else {
basic.showString("SKIP", 150) // ***
}
basic.plotImage(`
. . # . .
. # # # .
# # # # #
. . # . .
. . # . .
`)
})
```
* Run your code to see if it works as expected
### Challenge 3
Add some other messages, such as "TWO DARES" for the BBC micro:bit to show. You will need to modify the parameter inside `math->random(3)` as well as adding another `if` condition.

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше