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!
BhavithiranSC Lim
Published © MIT

EDU:BIT Night Light | MicroPython

Guide to program Night Light with EDU:BIT (project kit for micro:bit) using MicroPython

BeginnerFull instructions provided30 minutes644
EDU:BIT Night Light | MicroPython

Things used in this project

Hardware components

EDU:BIT
Cytron Technologies EDU:BIT
×1

Software apps and online services

Mu
Python Editor for micro:bit

Story

Read more

Code

Night Light

Python
This tutorial's full code
from edubit import *
import neopixel

np = neopixel.NeoPixel(pin13, 4)
display.show(Image.HAPPY)                        # show happy face on microbit display

while True:
	init()                                   # initialize EDU:BIT
	pValue = read_pot_value() >> 2           # convert 1023 to 255
	if is_IR_sensor_triggered():             # if IR sensor is triggered
	    for LED in range(4):
	        np[LED] = 255,pValue,50          # set all rgb pixel
	    np.show()                            # show color on rgb pixel

Credits

Bhavithiran

Bhavithiran

16 projects • 7 followers
SC Lim

SC Lim

13 projects • 13 followers
Husband · Dad | Loves tinkering & making

Comments