Things used in this project

Hardware components:
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
SparkFun Mini Photocell
×1
12002 04
Breadboard (generic)
×1
SparkFun micro:bit Breakout (with Headers)
×1
Microbitheart
BBC micro:bit board
×1

Schematics

Wiring Guide
Microbit light sensor stlpc05oyg
Instructions building using block-based editor

Code

Light Sensor CodePython
Fairly straightforward code. See attached pdf for block-based example too.
from microbit import *

while True:
    lightSensor = pin0.read_analog()
    if lightSensor > 512:
        sun = Image("90909:"
                    "09990:"
                    "99999:"
                    "09990:"
                    "90909")
        display.show(sun)
    elif lightSensor < 512:
        moon = Image("99900:"
                     "09990:"
                     "00990:"
                     "09990:"
                     "99900")
        display.show(moon)

Credits

8f44de8bafe25f1cb22533c194599e43
rypsmith
1 project • 0 followers
Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Add projectSign up / LoginAbout BBC micro:bit