Menú
"Dear young explorer, have you ever wondered how rainbows form? Why plants grow toward sunlight? Or if your body holds electrical secrets? Today, we invite you to grab your curiosity backpack and use micro:bit as your magic toolbox to explore the realms of light, water, force, sound, and electricity!"
Understand RGB color theory and create your own rainbow world
"When Newton passed sunlight through a prism, a rainbow appeared on the wall. Now, the RGB LEDs in your hands are like miniature prisms, waiting for you to recreate this classic experiment..."
1 // Advanced color cycling program 2 let strip = neopixel.create(DigitalPin.P16, 4, NeoPixelMode.RGB) 3 let hue = 0 4 5 basic.forever(() => { 6 // Cycle through all hues in HSV color space 7 strip.showColor(neopixel.hsv(hue, 100, 100)) 8 hue = (hue + 1) % 360 9 10 // Visual feedback on micro:bit display 11 let brightnessLevel = Math.map(hue, 0, 360, 0, 5) 12 let leds = "" 13 for (let i = 0; i < brightnessLevel; i++) { 14 leds += "#" 15 } 16 basic.showString(leds) 17 18 pause(100) 19 })
1 // Advanced environmental monitoring with historical data 2 OLED.init(128, 64) 3 let dht11 = DHT11.create(DigitalPin.P1) 4 let tempData: number[] = [] 5 let humidData: number[] = [] 6 7 basic.forever(() => { 8 let temp = dht11.temp() 9 let humidity = dht11.humidity() 10 11 // Store last 6 readings 12 if (tempData.length >= 6) { 13 tempData.shift() 14 humidData.shift() 15 } 16 tempData.push(temp) 17 humidData.push(humidity) 18 19 // Display data trends 20 OLED.clear() 21 OLED.writeStringNewLine("Temp Trend:") 22 for (let i = 0; i < tempData.length; i++) { 23 OLED.writeString(" " + tempData[i] + ">") 24 } 25 26 OLED.newLine() 27 OLED.writeStringNewLine("Humid Trend:") 28 for (let i = 0; i < humidData.length; i++) { 29 OLED.writeString(" " + humidData[i] + ">") 30 } 31 32 pause(60000) // Record every minute 33 })
Discuss how local measurements contribute to global understanding:
Understand water-life connection and become a plant whisperer
1 // Smart watering with learning capabilities 2 let pump = Relay.create(DigitalPin.P2) 3 let moistureSensor = AnalogPin.P1) 4 let wateringTimes: number[] = [] 5 let dailyWaterNeeds = 0 6 7 basic.forever(() => { 8 let moisture = pins.analogReadPin(moistureSensor) 9 let now = input.runningTime() 10 11 // Water when needed 12 if (moisture < 30) { 13 pump.turnOn() 14 basic.showIcon(IconNames.Umbrella) 15 pause(5000) 16 pump.turnOff() 17 18 // Record watering time 19 wateringTimes.push(now) 20 if (wateringTimes.length > 5) {
21 wateringTimes.shift() 22 } 23 24 // Calculate average daily need 25 dailyWaterNeeds = Math.round(wateringTimes.length * 5000 / 86400000) 26 basic.showString("" + dailyWaterNeeds + "ml/day") 27 } 28 29 pause(3600000) // Check hourly 30 })
1 // Advanced bioelectric monitoring 2 let baseline = 0 3 let readings: number[] = [] 4 let variation = 0 5 6 basic.forever(() => { 7 let voltage = pins.analogReadPin(AnalogPin.P1) 8 9 // Store last 10 readings 10 if (readings.length >= 10) { 11 readings.shift() 12 } 13 readings.push(voltage) 14 15 // Calculate baseline and variation 16 baseline = Math.median(readings) 17 variation = Math.max(readings) - Math.min(readings) 18 19 // Output analysis 20 serial.writeValue("baseline", baseline) 21 serial.writeValue("variation", variation) 22 23 // Simple mood detection 24 if (variation > 50) { 25 basic.showIcon(IconNames.Surprised) 26 } else { 27 basic.showIcon(IconNames.Happy) 28 } 29 30 pause(1000) 31 })
1 // Comprehensive ecosystem management 2 let lightStrip = neopixel.create(DigitalPin.P16, 4, NeoPixelMode.RGB) 3 let tempSensor = DHT11.create(DigitalPin.P1) 4 let pump = Relay.create(DigitalPin.P2) 5 let CO2 = 400 // Starting CO2 ppm 6 7 basic.forever(() => { 8 let temp = tempSensor.temp() 9 let humidity = tempSensor.humidity() 10 let moisture = pins.analogReadPin(AnalogPin.P1) 11 let lightLevel = input.lightLevel() 12 13 // Photosynthesis simulation 14 if (lightLevel > 128) { 15 CO2 = Math.max(300, CO2 - 5) 16 } else { 17 CO2 += 1 18 } 19 20 // Environment control 21 if (temp > 25) lightStrip.setBrightness(50) 22 if (humidity < 40) pump.turnOn(2000) 23 if (moisture < 30) pump.turnOn(5000) 24 25 // Ecosystem report 26 OLED.clear() 27 OLED.writeStringNewLine(`Temp:${temp}C Humid:${humidity}%`) 28 OLED.writeStringNewLine(`CO2:${CO2}ppm Soil:${moisture}`) 29 OLED.writeStringNewLine(`Light:${lightStrip.brightness()}%`) 30 31 pause(30000) // Update every 30 seconds 32 })
"When Alexander Fleming returned from vacation in 1928, he noticed something unexpected in his neglected petri dishes. Instead of discarding the 'failed' experiment, his curiosity about the mold led to the discovery of penicillin. Remember: In science, what looks like failure might be a breakthrough in disguise!"
Urban Soundscape Analysis:
"From Galileo's telescope to your micro:bit, the spirit of exploration connects generations of discoverers. You stand on the shoulders of giants, equipped with tools they could only dream of. What wonders will you reveal?"
"Young scientist, your journey has just begun. Each circuit you build, each line of code you write, each measurement you take - you're not just learning science, you're becoming science. The micro:bit is your compass, curiosity your fuel, and the natural world your infinite destination. Go discover what hasn't been discovered. Question what hasn't been questioned. And remember: The most important tool in your kit isn't the sensor or the code editor - it's your wonder-filled mind."