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

Function handle_loudness

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

Source from the content-addressed store, hash-verified

571
572
573def handle_loudness(regObj):
574 sensors = {}
575 loudness_reading = 0
576 port = "AD2" if regObj.group(SENSOR_LOUDNESS_PORT2_GROUP) else "AD1"
577 loudness = get_sensor_instance(port, easysensors.LoudnessSensor)
578 if loudness:
579 logger.debug("About to read loudness sensor on port " + port)
580 loudness_reading = loudness.percent_read()
581 logger.debug(loudness_reading)
582 sensors["{}: Loudness".format(port)] = loudness_reading
583 else:
584 return ({"{}: Loudness".format(port):"technical difficulties"})
585 return sensors
586
587def handle_led(regObj):
588 '''

Callers 1

Calls 2

get_sensor_instanceFunction · 0.85
percent_readMethod · 0.80

Tested by

no test coverage detected