![](/media/cache/group/tvz-logo.png.50x50_q85.png)
Simulacija rada semafora s 4 LED diode, 7 segmentog display-a, zvučnika, tipkala i potenciometra
Dependencies: mbed
buzzer.cpp
- Committer:
- dcindric
- Date:
- 2021-05-07
- Revision:
- 1:1b7ec94fe4ab
- Parent:
- 0:2531c2b824f9
File content as of revision 1:1b7ec94fe4ab:
#include "buzzer.h" AnalogIn potenciometar(PA_0); Buzz::Buzz(PinName pin) : _pwm(pin) { _pwm = 0; } void Buzz::buzzOff() { _pwm = 0.0; } void Buzz::buzz() { float frekvencija = potenciometar * 1000; if(frekvencija == 0) { buzzOff(); } else if(frekvencija != 0) { _pwm.period(1.0 / frekvencija); _pwm = 0.5; } }