Maxim Loick
Published © CC BY

Check if the door of the fridge is open.

When it's light, the door is open, Calliope says: Close the door!

EasyShowcase (no instructions)30 minutes223
Check if the door of the fridge is open.

Story

Read more

Code

mini-kühlschrankTür.hex

JavaScript
The sensor measures the lightness and returns 0 when it is dark and 255 when it's light.
basic.forever(() => {
    if (input.lightLevel() > 10) {
        basic.showString("Tür zu!")
    } else {
        basic.showString("Ah, ich bin allein! Da mach ich heimlich Disco!")
        basic.setLedColor(Colors.Red)
        basic.pause(100)
        basic.setLedColor(Colors.Yellow)
        basic.pause(100)
        basic.setLedColor(Colors.Green)
        basic.pause(100)
        basic.setLedColor(Colors.Blue)
        basic.pause(100)
    }
})

Credits

Maxim Loick

Maxim Loick

2 projects • 6 followers
Co-Founder of Calliope.
Contact

Comments