Light Sensor ============ The mPython Board has an onboard light sensor that can be used to detect changes in ambient light. Example: Light-controlled LED:: from mpython import * from lv_gui import * import time gui = GUI() while True: gui.fill(type=0) # Clear screen gui.draw_label(text=str('Lux:'+str(light.read())), row=1, color=0xffffff, wrap=False) # Display onboard light sensor gui.update() # Refresh time.sleep_ms(100) # Delay 100ms if light.read() < 500 : # When light is less than 500, LED on rgb.fill((50,50,50)) rgb.write() else: # Otherwise, LED off rgb.fill((0,0,0)) rgb.write() Use the ``light`` object to get light sensor data:: light.read() .. Note:: The light sensor uses the ``read()`` function to read data. The returned value is in lux. Now that you have learned how to collect ambient light data, you can combine it with other features to create more interesting scenarios.