Перейти к содержанию

Навигация

Buzzer/en: различия между версиями

Нет описания правки
(Обновление для соответствия новой версии исходной страницы.)
 
(не показано 10 промежуточных версий 2 участников)
Строка 1: Строка 1:
<languages/>
<languages/>
{{DISPLAYTITLE:Зуммер (звуковой излучатель)}}
{{DISPLAYTITLE:Buzzer}}


{{DISPLAYTITLE: Buzzer}}
==Description==
==Description==
The Wiren Board controller has a Buzzer (sound emitter) on board. The buzzer is powered by 5V and controlled by the CPU's gpio pin in PWM mode. The buzzer can be controlled through the sysfs interface of the kernel and various software on top of it. Management from the web interface, the wb-rules rule engine and python is now implemented.
The Wiren Board controller has a Buzzer (sound emitter) on board. The buzzer is powered by 5V and controlled by the CPU's gpio pin in PWM mode. The buzzer can be controlled through the sysfs interface of the kernel and various software on top of it. Also, it can be controlled via the web interface, the wb-rules rule engine and python.


==Management from web interface==
==Controlling via web-interface==


[[File:buzzer.png |300px|thumb|right| Buzzer control]]
[[File:buzzer.png |300px|thumb|right| Buzzer control]]
In the web interface of the controller, buzzer control is available in the ''"Devices"'' tab. Parameter ''"Frequency"'' - sound frequency in Hz. ''"Volume"'' - volume (in conventional units, linear scale). The settings are saved when the controller is rebooted.
In the web-interface of the controller, buzzer control is available in the ''"Devices"'' tab. Parameter ''"Frequency"'' - sound frequency in Hz. ''"Volume"'' - volume (in conventional units, linear scale). The settings are saved when the controller is rebooted.


==Control from rule engine==
==Controlling via rule engine==




The buzzer control displayed in the web interface is a virtual device created by the wb-rules system rule when the controller starts. The source code of the rule is available [https://github.com/wirenboard/wb-rules-system/blob/master/rules/buzzer.js on our github].
The buzzer control displayed in the web interface is a virtual device created by the wb-rules system rule when the controller starts. The source code of the rule is available [https://github.com/wirenboard/wb-rules-system/blob/master/rules/buzzer.js on our github].


You can learn more about what virtual devices are for in the [[wb-rules|description of the rules engine]].
You can learn more about virtual devices usage in the [[wb-rules|description of the rules engine]].


The system rule internally implements tone and volume recalculation (see [[#About PWM and parameter recalculation|section on recalculation]]) and work with pwm via sysfs (see [[#Working from sysfs|corresponding section]]). Outside, the user has access to the ''"buzzer"'' device, which has several mqtt controls:
The system rule internally implements tone and volume recalculation (see [[#About PWM and parameter recalculation|section on recalculation]]) and work with pwm via sysfs (see [[#Working from sysfs|corresponding section]]). Outside, the user has access to the ''"buzzer"'' device, which has several mqtt controls:
Строка 41: Строка 40:
Device controls can be used in custom rules. More details about the structure of mqtt topics for virtual and physical devices can be found in our [https://github.com/wirenboard/conventions/blob/main/README.md mqtt convention].
Device controls can be used in custom rules. More details about the structure of mqtt topics for virtual and physical devices can be found in our [https://github.com/wirenboard/conventions/blob/main/README.md mqtt convention].


==Control from python==
==Controlling via python==


On Wiren Board controllers, you can work with the buzzer from python using the ''beeper'' module from the ''wb_common'' package. This is a wrapper around the sysfs interface. The module is preinstalled on all controllers as part of the ''python-wb-common'' deb package. The source code is available [https://github.com/wirenboard/wb-common/blob/master/wb_common/beeper.py on our github].
On Wiren Board controllers, you can work with the buzzer from python using the ''beeper'' module from the ''wb_common'' package. This is a wrapper around the sysfs interface. The module is preinstalled on all controllers as part of the ''python-wb-common'' deb package. The source code is available [https://github.com/wirenboard/wb-common/blob/master/wb_common/beeper.py on our github].
translator, wb_editors
4234

правки