Skip to content

Commit

Permalink
Merge pull request #129 from katlinwalsh/main
Browse files Browse the repository at this point in the history
Updated wording and lesson formatting
  • Loading branch information
ross-inksmith authored Nov 1, 2024
2 parents ceb5d3b + b75525e commit f26eb0e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 43 deletions.
2 changes: 1 addition & 1 deletion gr8-smartfarming-modify.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ input.onButtonPressed(Button.B, function () {
```

## Modify Step 4
What do you think will happen if you liftthe bottom part of your moisture sensor back out of the water and hold it there? Try it now.
What do you think will happen if you lift the bottom part of your moisture sensor back out of the water and hold it there? Try it now.

Was this what you expected?

Expand Down
4 changes: 2 additions & 2 deletions gr9-treeSeeder-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ The micro:bit executes each block very quickly, so the contribution of each to r
## Solution 1 Continued
In this program, we have 3 ``||basic:pause||`` blocks which add up to 1500 milliseconds (or 1.5 seconds!) per loop. We also know 1 seed is planted each loop. Ultimately, this means it takes 1.5 seconds to plant each seed:

<img src="https://latex.codecogs.com/svg.image?\frac{1.5\;seconds}{1\;\cancel{loop}}\times\frac{1\;\cancel{loop}}{1\;seed}=\frac{1.5\;seconds}{seed}" style="width: 400px;">
<img src="https://latex.codecogs.com/svg.image?\frac{1.5\;seconds}{1\;\cancel{loop}}\times\frac{1\;\cancel{loop}}{1\;seed}=\frac{1.5\;seconds}{seed}" alt="A math equation: 1.5 seconds divided by 1 loop multiplied by 1 loop divided by one seed equals 1.5 seconds per seed" style="width: 400px;">

```block
for (let index = 0; index < 4; index++) {
Expand All @@ -262,7 +262,7 @@ In this program, we have 3 ``||basic:pause||`` blocks which add up to 1500 milli
## Solution 1 Continued
Knowing this, we can calculate that 1000 seeds will take 1500 seconds (or 25 minutes!) to plant!

<img src="https://latex.codecogs.com/svg.image?1000\;\cancel{seeds}\times\frac{1.5\;seconds}{1\;\cancel{seed}}=1500\;seconds" style="width: 450px;">
<img src="https://latex.codecogs.com/svg.image?1000\;\cancel{seeds}\times\frac{1.5\;seconds}{1\;\cancel{seed}}=1500\;seconds" alt="A math equation: 1000 seeds multipled by 1.5 seconds divided by 1 seed equals 1500 seconds." style="width: 450px;">

## Solution 1 Continued
Unfortunately, we have no way to estimate the distance traveled from the code alone.
Expand Down
44 changes: 6 additions & 38 deletions gr9-verticalfarm-modify.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ input.onButtonPressed(Button.AB, function () {
## Modify Step 4
Each ``||functions:call||`` block has a couple different numbers. What do you think these numbers mean?

Change the first number in the ``||functions:call||`` block under ``||input:on button A pressed||`` to something between ‘10’ and ‘60’. Then, re-download your code and test it out! What happened?
Change the **first number** in the ``||functions:call||`` block under ``||input:on button A pressed||`` to something between ‘10’ and ‘60’. Then, re-download your code and test it out! What happened?

~hint Tell me more!
- When A is pressed, the LED arm now moves to a new location.
Expand Down Expand Up @@ -405,39 +405,7 @@ function lightPlant (location: number, colour: number) {
basic.pause(5000)
}
```

## Modify Step 14
In the ``||fwdMotors:set leftServo to||`` block, select the down arrow next to ``||variables:list||`` and replace with ``||variables:location||``.

In the ``||fwdSensors:set all ledRing LEDs to||`` block, select the down arrow next to ``||variables:list||`` and replace with ``||variables:colour||``.

~hint Tell me more!
- This is how we can clarify that we want these two blocks to pull data from our ``||variables:location||`` and ``||variables:colour||`` lists.
- _Note: You may notice an error message, but it will be resolved in the next couple steps._
hint~

```block
function lightPlant (location: any[], colour: any[]) {
// @highlight
fwdMotors.leftServo.fwdSetAngleAndWait(location[0])
basic.showLeds(`
# . # . #
. # # # .
# # # # #
. # # # .
# . # . #
`)
// @highlight
fwdSensors.ledRing.fwdSetAllPixelsColour(colour[0])
basic.pause(5000)
fwdSensors.ledRing.fwdSetAllPixelsColour(0x000000)
basic.clearScreen()
fwdMotors.leftServo.fwdSetAngleAndWait(0)
basic.pause(5000)
}
```

## Modify Step 15
So, we've added our lists to the function, but the micro:bit still doesn't know _which_ number to pull from each.

Thankfully, lists are ordered! We can use a concept known as **index** to target a specific number in each list. In most programming languages, the first item in a list has an index of 0, the second item has an index of 1, and so on.
Expand All @@ -449,7 +417,7 @@ Today, we have stored the data in this order:
- Data for plants in the _bottom_ row in our farm is always the third number in our lists (aka index 2).
hint~

## Modify Step 16
## Modify Step 15
Since each row is linked to a specific index, the ``||variables:index||`` can be our new parameter.

Right click on the function block and click ‘Edit Function’. Delete the ‘colour’ parameter by clicking on it and selecting the trash can that appears. Rename the ‘location’ parameter ‘index’.
Expand All @@ -474,7 +442,7 @@ function lightPlant (index: number) {
}
```

## Modify Step 17
## Modify Step 16
Drag ``||variables:index||`` from the function block and add it to both ``||arrays:get value at 0||`` blocks.

This is how we tell the micro:bit to pull the location and colour data for the top row of plants (index = 0), middle row of plants (index = 1), or bottom row of plants (index = 2).
Expand All @@ -500,7 +468,7 @@ function lightPlant (index: number) {
}
```

## Modify Step 18
## Modify Step 17
Finally, we must update our ``||functions:call||`` blocks to reflect these changes.

When we press A, we want to light the plants on the _top row_ of our vertical farm. What value should we use for ``||variables:index||`` in the ``||functions:call lightPlant||`` under ``||input:on button A pressed||``?
Expand Down Expand Up @@ -534,7 +502,7 @@ input.onButtonPressed(Button.A, function () {
})
```

## Modify Step 19
## Modify Step 18
What argument should we use for ``||variables:index||`` in the ``||functions:call lightPlant||`` block under ``||input:on button B pressed||``? ``||input:On button A+B pressed||``?

~hint Tell me more!
Expand Down Expand Up @@ -571,7 +539,7 @@ input.onButtonPressed(Button.AB, function () {
})
```

## Modify Step 20
## Modify Step 19
Download your code to test it out! What do you notice?

~hint Tell me more!
Expand Down
4 changes: 2 additions & 2 deletions ms-sodis-modify.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ Assume the SODIS timer is being used in a climate that is mostly sunny. Sunny co
## Challenge Step 2
To create a visual indicator when the water is safe to drink on a sunny day, we need to write another decision point or conditional statement. This conditional will allow the micro:bit to evaluate whether the exposure threshold has been met. In sunny weather, this threshold is 6 hours.

Think about how you could phrase this decision point in English using an if/then statement.
Think about how you could phrase this decision point using an if/then statement.

~hint Tell me more!
- In English, you might say "If the water has been exposed to UV for 6 hours, then show a smiley face on the micro:bit's LEDs."
- You might say "If the water has been exposed to UV for 6 hours, then show a smiley face on the micro:bit's LEDs."
- The visual indicator doesn't have to be a smiley face, it could be anything!
hint~

Expand Down

0 comments on commit f26eb0e

Please sign in to comment.