From f69b6195cadddb8e4a3cd4238d9fca69448d2052 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Sun, 15 Nov 2015 11:44:29 +0000 Subject: [PATCH] Fix #75 Alias blink to beep for Buzzer --- docs/outputs.md | 6 +++--- gpiozero/output_devices.py | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/outputs.md b/docs/outputs.md index 0d5fcdf..b73d153 100644 --- a/docs/outputs.md +++ b/docs/outputs.md @@ -110,10 +110,10 @@ Buzzer(pin=None, active_high=True) | `on()` | Turn the buzzer on. | None | | `off()` | Turn the buzzer off. | None | | `toggle()` | Toggle the buzzer. If it's on, turn it off; if it's off, turn it on. | None | -| `blink()` | Make the LED turn on and off repeatedly. | `on_time` - The amount of time (in seconds) for the LED to be on each iteration. **Default: `1`** | -| | | `off_time` - The amount of time (in seconds) for the LED to be off each iteration. **Default: `1`** | +| `beep()` | Make the buzzer turn on and off repeatedly. | `on_time` - The amount of time (in seconds) for the buzzer to be on each iteration. **Default: `1`** | +| | | `off_time` - The amount of time (in seconds) for the buzzer to be off each iteration. **Default: `1`** | | | | `n` - The number of iterations. `None` means infinite. **Default: `None`** | -| | | `background` - If `True`, start a background thread to continue blinking and return immediately. If `False`, only return when the blink is finished (warning: the default value of n will result in this method never returning). **Default: `True`** | +| | | `background` - If `True`, start a background thread to continue beeping and return immediately. If `False`, only return when the blink is finished (warning: the default value of n will result in this method never returning). **Default: `True`** | #### Properties diff --git a/gpiozero/output_devices.py b/gpiozero/output_devices.py index 197ad27..0a85915 100644 --- a/gpiozero/output_devices.py +++ b/gpiozero/output_devices.py @@ -205,6 +205,8 @@ class Buzzer(DigitalOutputDevice): """ pass +Buzzer.beep = Buzzer.blink + class PWMOutputDevice(DigitalOutputDevice): """