Program opisuje signalizaciju otvaranja garaznih vrata. Kada su vrata zatvorena svjetli crvena ledica, na pritisak tipkala pokreće se otvaranje vrata. signalizacija otvaranja vrata je titrajuća zuta ledica i zvuk iz buzzera. Kada su vrata otvorena svjetli zelena ledica.
Dependencies: Piezo_zvucnik
Revision 1:31d5c6e076c0, committed 2021-12-09
- Comitter:
- dgerin
- Date:
- Thu Dec 09 08:10:13 2021 +0000
- Parent:
- 0:054375111414
- Commit message:
- Konstrukcijski zadatak
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Buzzer.lib Thu Dec 09 08:10:13 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/TVZ2021/code/Piezo_zvucnik/#ccd9568bdbfc
--- a/buzzer.cpp Thu Dec 09 07:52:53 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -#include "buzzer.h" -#include "mbed.h" - -using namespace mbed; - -Beep::Beep(PinName pin) : _pwm(pin) -{ - _pwm.write(0.0); -} - -void Beep::nobeep() -{ - _pwm.write(0.0); -} - - -void Beep::beep(float freq, float time) -{ - - _pwm.period(1.0/freq); - _pwm.write(0.5); - toff.attach(this,&Beep::nobeep, time); -} \ No newline at end of file
--- a/buzzer.h Thu Dec 09 07:52:53 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#ifndef MBED_BEEP_H -#define MBED_BEEP_H - -#include "mbed.h" - -namespace mbed { - -class Beep { - -public: - - Beep (PinName pin); - - void beep (float frequency, float time); - - void nobeep(); - -private : - PwmOut _pwm; - Timeout toff; -}; - -} -#endif - \ No newline at end of file