from engi1020.arduino.api import * # Read the current light level (port A6) light = analog_read(6) # Turn the LED (port D4) if light is bright if light > 400: digital_write(4, True) else: digital_write(4, False)