MCPcopy Create free account
hub / github.com/DexterInd/GoPiGo3 / handle_light

Function handle_light

Software/Scratch/GoPiGo3Scratch.py:560–570  ·  view source on GitHub ↗
(regObj)

Source from the content-addressed store, hash-verified

558
559
560def handle_light(regObj):
561 sensors = {}
562 light_reading = 0
563 port = "AD2" if regObj.group(SENSOR_LIGHT_PORT2_GROUP) else "AD1"
564 light = get_sensor_instance(port, easysensors.LightSensor)
565 if light:
566 light_reading = light.percent_read()
567 sensors["{}: Light".format(port)] = light_reading
568 else:
569 return ({"{}: Light".format(port):"technical difficulties"})
570 return sensors
571
572
573def handle_loudness(regObj):

Callers 1

Calls 2

get_sensor_instanceFunction · 0.85
percent_readMethod · 0.80

Tested by

no test coverage detected