Two Micro:bits Talk About the Weather in Spanish
36 Views, 0 Favorites, 0 Comments
Two Micro:bits Talk About the Weather in Spanish
Objective:
Design and build a simple wireless communication system using BBC micro:bits, where one micro:bit sends a weather-related question or command using button presses or gestures, and another micro:bit responds with the appropriate text or temperature reading on its LED display.
Learning Outcomes
Understanding radio communication between micro:bits
Using conditional statements to trigger specific responses
Reading real-world data (temperature) with micro:bit sensors
Mapping user inputs to meaningful actions
Asking how's the weather like in Spanish
Downloads
Supplies
Materials Required:
2 x BBC micro:bit boards
2 x Micro USB cables
2 x Battery packs (optional, for wireless use)
2 paper people and markers
Computer with MakeCode
How It Works - Micro:bit 1 (Sender)
- Button A: Sends number 1 – Asks "¿Qué tiempo hace?" (What's the weather like?)
- Button B: Sends number 2 – Says "Hace calor" (It's hot)
- Button A+B: Sends number 3 – Asks "¿Cuál es la temperatura?" (What is the temperature?)
- Shake gesture: Sends number 4 – Requests the actual temperature from Micro:bit 2
How It Works - Micro:bit 2 (Receiver):
Listens for incoming numbers via radio.
Depending on the received number:
- 1: Displays "que tiempo hace"
- 2: Displays "Hace calor"
- 3: Displays "Cual es la temperatura"
- 4: Displays the actual temperature read from the micro:bit’s onboard sensor
Code
CODE
Image of the Block code
hex file attached
Code in Java
radio.onReceivedNumber(function (receivedNumber) {
if (receivedNumber == 1) {
basic.showString("que tiempo hace")
} else if (receivedNumber == 2) {
basic.showLeds(`
# . # . #
. # # # .
. # # # .
. # # # .
# . # . #
`)
basic.clearScreen()
basic.showString("Hace calor")
} else if (receivedNumber == 3) {
basic.showString("Cual es la temperatura")
} else if (receivedNumber == 4) {
basic.showString("" + (input.temperature()))
}
})
input.onButtonPressed(Button.A, function () {
radio.sendNumber(1)
})
input.onButtonPressed(Button.AB, function () {
radio.sendNumber(3)
})
input.onButtonPressed(Button.B, function () {
radio.sendNumber(2)
})
input.onGesture(Gesture.Shake, function () {
radio.sendNumber(4)
})
radio.setGroup(5)
Project in Action
Video
Personal Reflection
A personal reflection of this project.