Maximillan Brown
Published

Beeping Earth

A globe that beeps when light is shined on the top.

BeginnerShowcase (no instructions)387
Beeping Earth

Story

Read more

Code

Javascript code from Microsoft Makecode

JavaScript
from Microsoft Makecode
input.onLightConditionChanged(LightCondition.Bright, function () {
	
})
input.onLightConditionChanged(LightCondition.Dark, function () {
	
})
input.setLightThreshold(LightCondition.Dark, 100)
input.setLightThreshold(LightCondition.Bright, 100)
forever(function () {
    if (input.lightLevel() >= 180) {
        music.playTone(988, music.beat(BeatFraction.Whole))
    } else {
        light.clear()
    }
})
forever(function () {
    if (input.lightLevel() >= 180) {
        light.showRing(
        "red red red red red red red red red red"
        )
        light.clear()
    } else {
        light.clear()
    }
})

Credits

Maximillan Brown
4 projects • 0 followers

Comments