Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
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!

BeginnerShowcase (no instructions)30 minutes226
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.

Comments