Skip to content

Commit

Permalink
Merge branch 'master' into change-oldstyle-function-parm
Browse files Browse the repository at this point in the history
  • Loading branch information
ganicke authored Aug 15, 2024
2 parents f419496 + 93966da commit e005e6a
Show file tree
Hide file tree
Showing 52 changed files with 699 additions and 237 deletions.
2 changes: 1 addition & 1 deletion docs/courses.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Tutorials, lessons, and mini-courses about programming and computing.
}, {
"name": "Networking with the micro:bit",
"description": "A series of activities to teach the basics of computer networks.",
"url": "https://microbit.nominetresearch.uk/",
"url": "https://www.digitaltechnologieshub.edu.au/search/networking-with-the-micro-bit/",
"imageUrl": "/static/courses/networking-book.png"
}, {
"name": "SparkFun Videos",
Expand Down
6 changes: 5 additions & 1 deletion docs/extensions/extension-gallery.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ Many extensions are available to work with interface kits, add-on hardware, or o
"cardType": "package"
}, {
"name": "WiFi:Bit",
"url":"/pkg/e-radionicacom/pxt-wifi",
"url":"/pkg/SolderedElectronics/pxt-wifi",
"cardType": "package"
}, {
"name": "ESP8266 and ThingSpeak",
Expand Down Expand Up @@ -521,6 +521,10 @@ Many extensions are available to work with interface kits, add-on hardware, or o

```codecard
[{
"name": "Lectrify Brick:Bit",
"url":"/pkg/softsmyth/lectrify-b4k",
"cardType": "package"
}, {
"name": "KittenBot TabbyBot",
"url":"/pkg/KittenBot/pxt-tabbyrobot",
"cardType": "package"
Expand Down
2 changes: 1 addition & 1 deletion docs/projects/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
* [micro:bit Data and Sustainability](https://mrmorrison.co.uk/microbit/datasustainability/)
* [First Steps](https://microbit.org/get-started/first-steps/introduction/)
* [Make it: code it](https://microbit.org/projects/make-it-code-it/)
* [Networking with the micro:bit](https://microbit.nominetresearch.uk/)
* [Networking with the micro:bit](https://www.digitaltechnologieshub.edu.au/search/networking-with-the-micro-bit/)
* [SparkFun Videos](https://youtu.be/kaNtg1HGXbY?list=PLBcrWxTa5CS0mWJrytvii8aG5KUqMXvSk)
* [Logic Lab](/courses/logic-lab)
* [CodeJoy Remote Robotics](https://www.codejoyeducation.com)
Expand Down
14 changes: 7 additions & 7 deletions docs/projects/level.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Level

## Introduction @unplugged
## Is it level? @unplugged

Is your table flat? Use the @boardname@ as a level!

![A level drawing](/static/mb/projects/level.png)


## Step 1
## {Step 1}

Make a variable ``||variables:x||`` and store the ``||input:acceleration x||`` value
in the ``||basic:forever||`` loop.
Expand All @@ -19,7 +19,7 @@ basic.forever(function() {
})
```

## Step 2
## {Step 2}

Make another variable ``||variables:y||`` and store the ``||input:acceleration y||`` value.

Expand All @@ -31,7 +31,7 @@ basic.forever(function() {
})
```

## Step 3
## {Step 3}

Add a code to test ``||logic:if||`` the ``||Math:absolute value||`` of ``||variables:x||`` is ``||logic:greater than||`` ``32``.
If it is true, ``||basic:show an icon||`` to tell you that the @boardname@ is not flat, ``||logic:else||`` show nothing, for now.
Expand All @@ -49,7 +49,7 @@ basic.forever(function() {
})
```

## Step 4
## {Step 4}

Add an ``||logic:else if||`` to check that the ``||Math:absolute value||`` of ``||variables:y||`` is ``||logic:greater than||`` ``32``.
If it is true, ``||basic:show an icon||`` that tells you the @boardname@ is not flat.
Expand All @@ -69,7 +69,7 @@ basic.forever(function() {
})
```

## Step 5
## {Step 5}

The code under the ``||logic:else||`` will run if both acceleration ``x`` and ``y`` are small, which happens when the @boardname@ is laying flat. Add code to ``||basic:show a happy image||``.

Expand All @@ -88,7 +88,7 @@ basic.forever(function() {
})
```

## Step 6
## {Step 6}

If you have a @boardname@ connected, click ``|Download|`` to transfer your code!
Try it out on a table, counter, or window sill in your house!
Expand Down
2 changes: 1 addition & 1 deletion docs/projects/plot-acceleration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ basic.forever(function() {

## Other sensors

You can use this block for pretty much any kind of data. Try it out! Plot the ``||input:light level||`` inside the ``||loops:forever||`` instead. Play with the light sensor in the simulator.
You can use this block for pretty much any kind of data. Try it out! Plot the ``||input:light level||`` inside the ``||basic:forever||`` instead. Play with the light sensor in the simulator.

```blocks
basic.forever(function() {
Expand Down
16 changes: 6 additions & 10 deletions docs/projects/python/smiley-buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

### @explicitHints true

## Introduction @unplugged
## Code a micro:bit emoji! @unplugged

Code the buttons on the @boardname@ to show that it's happy or sad.
(Want to learn how the buttons works? [Watch this video](https://youtu.be/t_Qujjd_38o)).

![Pressing the A and B buttons](/static/mb/projects/smiley-buttons/sim.gif)

## Step 1
## {Step 1}

Put in an ``||input:on button pressed||`` event to run code when button **A** is pressed.

Expand All @@ -19,7 +19,7 @@ def on_button_pressed_a():
input.on_button_pressed(Button.A, on_button_pressed_a)
```

## Step 2
## {Step 2}

Use ``||basic:show icon||`` to display a **Happy** face on the screen.

Expand All @@ -31,7 +31,7 @@ def on_button_pressed_a():
input.on_button_pressed(Button.A, on_button_pressed_a)
```

## Step 3
## {Step 3}

Use another ``||input:on button pressed||`` with a ``||basic:show icon||`` inside to display a **Sad** face when button **B** is pressed.

Expand All @@ -41,7 +41,7 @@ def on_button_pressed_a2():
input.on_button_pressed(Button.B, on_button_pressed_a2)
```

## Step 4
## {Step 4}

Add a secret mode that happens when **A** and **B** are pressed together. For this case, use ``||basic:show icon||`` multiple times to create an animation.

Expand All @@ -52,10 +52,6 @@ def on_button_pressed_a3():
input.on_button_pressed(Button.AB, on_button_pressed_a3)
```

## Step 5
## {Step 5}

Click ``|Download|`` to transfer your code to your @boardname@ (if you have one). Try buttons **A**, **B** and then **A** and **B** together.

## Step 6

If you have a @boardname@ connected, click ``|Download|`` and transfer your code to the @boardname@!
5 changes: 3 additions & 2 deletions docs/projects/soil-moisture/code.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ This saves electricity and also avoids corrosion of the probes.
led.setBrightness(64)
let reading = 0
basic.forever(function () {
pins.analogWritePin(AnalogPin.P1, 1023)
pins.digitalWritePin(DigitalPin.P1, 1)
basic.pause(1)
reading = pins.analogReadPin(AnalogPin.P0)
pins.analogWritePin(AnalogPin.P1, 0)
pins.digitalWritePin(DigitalPin.P1, 0)
led.plotBarGraph(
reading,
1023
Expand Down
10 changes: 4 additions & 6 deletions docs/projects/soil-moisture/connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,13 @@ To make it happen, we need to change the program to:
* send the moisture level **divided by 4** as the dashboard takes values between ``0`` and ``255``.

```blocks
radio.setTransmitSerialNumber(true)
radio.setGroup(4)
led.setBrightness(64)
let reading = 0
basic.forever(function ()) {
pins.analogWritePin(AnalogPin.P1, 1023)
basic.forever(function () {
pins.digitalWritePin(DigitalPin.P1, 1)
basic.pause(1)
reading = pins.analogReadPin(AnalogPin.P0)
radio.sendNumber(reading / 4)
pins.analogWritePin(AnalogPin.P1, 0)
pins.digitalWritePin(DigitalPin.P1, 0)
led.plotBarGraph(
reading,
1023
Expand Down
18 changes: 9 additions & 9 deletions docs/projects/spy/7-seconds.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

### @explicitHints true

## Introduction @unplugged
## Can you react at the right time? @unplugged

The goal of this game is press a button after **exactly** 7 seconds!

![A micro:bit looking at a 7 second stopwatch](/static/mb/projects/7-seconds.png)

This game is inspired from the [flipping panckakes game](https://www.elecfreaks.com/blog/post/flipping-pancakes-microbit-game.html).
This game is inspired from the [flipping pancakes game](https://www.elecfreaks.com/blog/post/flipping-pancakes-microbit-game.html).

## Step 1
## {Step 1}

The player starts the timer by pressing button **A**. Add the code to run code when
``||input:button A is pressed||``.
Expand All @@ -21,7 +21,7 @@ input.onButtonPressed(Button.A, function () {
})
```

## Step 2
## {Step 2}

We need to remember the time when the button was pressed so that we can compute the elapsed
time later on. Add code to store the ``||input:running time||`` in a ``||variables:start||``
Expand All @@ -35,7 +35,7 @@ input.onButtonPressed(Button.A, function () {
})
```

## Step 3
## {Step 3}

Show something on the screen so that the user knows that the timer has started...

Expand All @@ -48,7 +48,7 @@ input.onButtonPressed(Button.A, function () {
})
```

## Step 4
## {Step 4}

The player stops the timer by pressing button **B**. Add another event to run code when
``||input:button B is pressed||``.
Expand All @@ -59,7 +59,7 @@ input.onButtonPressed(Button.B, function () {
})
```

## Step 5
## {Step 5}

Compute the elapsed time as ``||input:running time||`` ``||math:minus||`` ``||variables:start||`` and
store it in a new local variable (a variable only inside the event) called ``||variables:elapsed||``.
Expand All @@ -72,7 +72,7 @@ input.onButtonPressed(Button.B, function () {
})
```

## Step 6
## {Step 6}

Compute the ``||variables:score||`` of the game as the ``||math:absolute value||`` of the
``||math:difference||`` of ``||variables:elapsed||`` time from 7 seconds, which is `7000`
Expand All @@ -87,7 +87,7 @@ input.onButtonPressed(Button.B, function () {
})
```

## Step 7
## {Step 7}

Display the score on the screen and your game is ready!

Expand Down
16 changes: 8 additions & 8 deletions docs/projects/spy/coin-flipper.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

### @explicitHints true

## Introduction @unplugged
## Heads or Tails? @unplugged

Let's create a coin flipping program to simulate a real coin toss. We'll use icon images to represent a ``heads`` or ``tails`` result.

![Simulating coin toss](/static/mb/projects/coin-flipper/coin-flipper.gif)

## Step 1
## {Step 1}

Add an event to run code when ``||input:button A pressed||``. We'll put our coin flipping
code in here.
Expand All @@ -18,7 +18,7 @@ input.onButtonPressed(Button.A, function () {
})
```

## Step 2
## {Step 2}

Inside the event for ``||input:button A pressed||``, put in code to check ``||logic:if||`` a ``||math:random boolean||`` value is `true` or `false`.

Expand All @@ -33,7 +33,7 @@ input.onButtonPressed(Button.A, function () {
})
```

## Step 3
## {Step 3}

Now, ``||basic:show icon||`` for a `skull` ``||logic:if||`` the ``||math:random boolean||`` value is ``true``. This means ``heads``. ``||basic:show icon||`` of a ``square`` when ``false`` to mean
``tails``.
Expand All @@ -48,11 +48,11 @@ input.onButtonPressed(Button.A, function () {
})
```

## Step 4
## {Step 4}

Press button **A** in the simulator to try the coin toss code.

## Step 5
## {Step 5}

You can animate the coin toss to add the feeling of suspense. ``||basic:show||`` different
icons before the check of the ``||math:random boolean||`` value to show that the
Expand All @@ -72,10 +72,10 @@ input.onButtonPressed(Button.A, function () {
})
```

## Step 6
## {Step 6}

If you have a @boardname@, connect it to USB and click ``|Download|`` to transfer your code.

## Step 7
## {Step 7}

Press button **A** for a flip. Test your luck and guess ``heads`` or ``tails`` before the toss is over!
Loading

0 comments on commit e005e6a

Please sign in to comment.