Najad
Published © GPL3+

LDR with BBC micro:bit

We are going to print “BRIGHT” in the inbuild LED matrix of the micro:bit if there is light in the room or else “DARK” will be printed.

BeginnerProtip1,163
LDR with BBC micro:bit

Things used in this project

Hardware components

UTSOURCE Electronic Parts
UTSOURCE Electronic Parts
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1
UTSOURCE bbc micro:bit
×1

Story

Read more

Schematics

circuit_mnvQDAWbhe.png

Code

Code snippet #1

JavaScript
basic.forever(function () {
    if (pins.analogReadPin(AnalogPin.P0) <= 1000) {
        basic.showString("DARK")
    } else {
        basic.showString("BRIGHT")
    }
})

Credits

Najad
30 projects • 97 followers
Just crazy stuff​

Comments