Brittany Bull
Published © MIT

Humidity Meter - With A SHAKE!

Super simple yet fun humidity project. Easy assembly and programming, you'll be ready to shake in 5 minutes.

EasyFull instructions provided5 minutes238
Humidity Meter - With A SHAKE!

Things used in this project

Story

Read more

Code

Micro:bit Humidity Project Code

JavaScript
It is JavaScript code that can be converted into blocks using the makecode.microbit.org webpage. This code allows you to measure the humidity levels with the circuit built in the above tutorial. It can easily be adjusted to your own preferences within the parameters allowed in the micro:bit software
let Humidity = 0
input.onButtonPressed(Button.A, () => {
    if (Humidity < 30) {
        OLED.showString("DRY")
    } else {
        OLED.showString("Moderate")
    }
    if (Humidity > 70) {
        OLED.showString("HUMID!!!")
    } else {
        OLED.showString("Moderate")
    }
})
input.onGesture(Gesture.Shake, () => {
    OLED.showString("Humidity")
    OLED.showNumber(Humidity)
    basic.pause(100)
})
basic.showLeds(`
    # . . . #
    . # . # .
    . . # . .
    . # . # .
    # . . . #
    `)
OLED.init(64, 128)
weatherbit.startWeatherMonitoring()
OLED.showString("Humidity Project")
Humidity = weatherbit.humidity() / 1024

Credits

Brittany Bull

Brittany Bull

13 projects • 5 followers
A student exploring the world of coding and IoT from a beginners' perspective

Comments