fwd-edu-breakout=github:climate-action-kits/pxt-fwd-edu/fwd-breakout
sonar=github:climate-action-kits/pxt-fwd-edu
datalogger=datalogger
input.onGesture(Gesture.Shake, function () {
basic.showLeds(`
. . . . .
# . # # .
# # # . #
# . # # .
. . . . .
`)
})
Let's build our smart seaweed farm! We will do this in three parts:
- Build your model
- Add code so it can detect movement
- Use and test your model to see how it works
Note: If you have the CHARGE for micro:bit, you can use it here!
Now it’s time to bring your model to life with code! The code will be the instructions that tell our micro:bit what to do.
Click the three dots beside the |Download|
button, then click on Connect Device.
Next, follow the steps to pair your micro:bit.
Next, click the |Download|
button to download the code to your project.
We are now ready to test out our farm model to see how it detects when animals get tangled in its ropes.
Tutorial Tips
- Follow the steps at the top of the screen.
- When you are ready for more details, click 'Tell me more!'
- If you need help with the code, click the lightbulb!
Take a close look at the model you just built. Can you name all its parts?
~hint Tell me more! This model uses:
- Building Blocks: One baseplate, two medium white frames, four long white frames, and four cube connectors
- Craft supplies: Rope, elastic, yarn or string and construction paper
- Robotic Parts: A micro:bit with an accelerometer hint~
Imagine this is a real seaweed farm in the ocean.
What do these different parts represent? Why do you think the micro:bit is hanging from the ropes?
~hint Tell me more!
- The ropes represent the lines where the seaweed grows. We crafted our own seaweed with construction paper!
- The building blocks represent the poles that anchor the seaweed lines. They keep the ropes steady in the water.
- The micro:bit is hanging from one of the ropes so it can sense whenever the rope moves. For example, this might happen if an animal got tangled in it. hint~
Time to test out the model.
Try gently tugging or shaking different parts of the rope. When does the micro:bit respond?
~hint Tell me more!
- The sensor responds best when you shake the rope closest to it. If the movement is too far away, it is not always detected.
- When the micro:bit does detect movement, it shows a fish on the LEDs. hint~
input.onGesture(Gesture.Shake, function () {
// @highlight
basic.showLeds(`
. . . . .
# . # # .
# # # . #
# . # # .
. . . . .
`)
})
Real seaweed farms might also be affected by waves. Let’s test if your sensor can tell the difference between waves and an animal getting stuck.
Gently rock your rope or model back and forth, mimicking the motion of the ocean waves. Does the micro:bit respond?
~hint Tell me more!
- The sensor should be able to tell the difference between predictable wave patterns and sudden, unpredictable shaking movement.
- Right now, the
||input:on shake||
block is being used to send out the alert. This block is designed to detect sudden, unusual movement, like an animal bumping into the ropes repeatedly. hint~
// @highlight
input.onGesture(Gesture.Shake, function () {
basic.showLeds(`
. . . . .
# . # # .
# # # . #
# . # # .
. . . . .
`)
})
Let's take a minute to reflect.
What does your model do well?
~hint Tell me more!
- It can tell the difference between the gentle rocking of waves and the sudden shaking caused by an animal. hint~
What could be improved in this model? How might you make it even better?
~hint Tell me more! We could:
- add more sensors across the ropes to help detect movement all over the farm.
- use brightly coloured ropes to make it easier for animals to see and avoid.
- tighten the ropes! Research shows that animals are less likely to get caught in tight ropes. hint~
You've completed the activity!
List 2 new things you learned today.
What is one thing you want to learn more about?
In the next step, you can click the |Done|
button to finish the tutorial.