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

Function handle_GoPiGo3_Sensor_msg

Software/Scratch/GoPiGo3Scratch.py:472–515  ·  view source on GitHub ↗
(msg)

Source from the content-addressed store, hash-verified

470
471
472def handle_GoPiGo3_Sensor_msg(msg):
473 logger.debug("received sensor {}".format(msg.strip().lower()))
474
475 sensors = {}
476 regObj = compiled_regexSensors.match(msg.strip().lower())
477 if regObj is None:
478 logger.info("GoPiGo3 Sensor command is not recognized")
479 return None
480
481 # for i in range(len(regObj.groups())+1):
482 # logger.debug ("{}: {}".format(i,regObj.group(i)))
483
484 if regObj.group(SENSOR_DISTANCE_GROUP):
485 logger.info("distance sensor")
486 sensors = handle_distance(regObj)
487
488 elif regObj.group(SENSOR_BUZZER_GROUP):
489 logger.info("buzzer")
490 sensors = handle_buzzer(regObj)
491
492 elif regObj.group(SENSOR_LED_GROUP):
493 logger.info("led")
494 sensors = handle_led(regObj)
495
496 elif regObj.group(SENSOR_LIGHT_GROUP):
497 logger.info("light sensor")
498 sensors = handle_light(regObj)
499
500 elif regObj.group(SENSOR_SERVO_GROUP):
501 logger.info("servo")
502 sensors = handle_servos(regObj)
503
504 elif regObj.group(SENSOR_BUTTON_GROUP):
505 logger.info("button")
506 sensors = handle_button(regObj)
507
508 elif regObj.group(SENSOR_DHT_GROUP):
509 logger.info("dht")
510 sensors = handle_dht(regObj)
511
512 elif regObj.group(SENSOR_LOUDNESS_GROUP):
513 logger.info("loudness")
514 sensors = handle_loudness(regObj)
515 return sensors
516
517
518def handle_dht(regObj):

Callers 1

GoPiGo3Scratch.pyFile · 0.85

Calls 8

handle_distanceFunction · 0.85
handle_buzzerFunction · 0.85
handle_ledFunction · 0.85
handle_lightFunction · 0.85
handle_servosFunction · 0.85
handle_buttonFunction · 0.85
handle_dhtFunction · 0.85
handle_loudnessFunction · 0.85

Tested by

no test coverage detected