''' Mission 12 - Night Light Medium Solution - The remix uses CodeX as a counter. It counts when something passes across it, changing the light intensity to dark. This version also shows an image and waits a short amount of time before checking again so the same person isn't counted twice. ''' from codex import * from time import sleep # select a value slightly under the # room light readings DARK = 2000 # initialize count and set screen count = 0 pixels.fill(BLACK) display.print(count, color=BLUE, scale=10) while True: value = light.read() # darkest value if value < DARK: # turn on pixels, display target, increment count pixels.fill(GREEN, brightness=20) display.show(pics.TARGET) count = count + 1 # wait one second before reading light sensor again sleep(1) # turn off pixels, display count pixels.fill(BLACK) display.clear() display.print(count, color=BLUE, scale=10)