Qing Wei
Published © GPL3+

Protest board of global warming issue

A protest board with a temperature sensor

BeginnerFull instructions provided3 hours379
Protest board of global warming issue

Story

Read more

Code

Temperature sensor code of circuit playground express

C#
The original code is from adafruit make it sense website(https://learn.adafruit.com/make-it-sense/using-the-temperature-sensor). I made some changes so the lights will turn red with a beeping sound when the temperature is lower than 26 °c. When the temperate is higher than 26 °c, the board will make no sound and the lights will be green.
let temp = 0
forever(function () {
    temp = input.temperature(TemperatureUnit.Celsius)
    if (temp < 26) {
        light.setAll(0xff0000)
        music.jumpUp.play()
    } else {
        light.setAll(0x00ff00)
        pause(2000)
        light.clear()
    }
})

Credits

Qing Wei
3 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.