if a port is not provided assume AD1
(regObj)
| 602 | |
| 603 | |
| 604 | def handle_buzzer(regObj): |
| 605 | ''' |
| 606 | if a port is not provided assume AD1 |
| 607 | ''' |
| 608 | sensors = {} |
| 609 | port = "AD2" if regObj.group(SENSOR_BUZZER_PORT2_GROUP) else "AD1" |
| 610 | try: |
| 611 | power = float(regObj.group(SENSOR_BUZZER_POWER_GROUP)) |
| 612 | except: |
| 613 | power = 100 if regObj.group(SENSOR_BUZZER_POWER_GROUP)=="on" else 0 |
| 614 | Buzzer = get_sensor_instance(port, easysensors.Buzzer) |
| 615 | if Buzzer: |
| 616 | Buzzer.sound(power) |
| 617 | return {"{}: Buzzer".format(port):power} |
| 618 | |
| 619 | |
| 620 | def handle_distance(regObj): |
no test coverage detected