![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Ognjen Arbutina 2020/0581
Revision 0:7ebdc53b1d02, committed 2021-11-13
- Comitter:
- arbutinao
- Date:
- Sat Nov 13 08:48:27 2021 +0000
- Commit message:
- Ognjen Arbutina 2020/0581
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 13 08:48:27 2021 +0000 @@ -0,0 +1,58 @@ +/* +* Prikazana vrednost na displeju ne pokazuje ono sto se moze cuti. To se desava zbog razlicitih stanja na potenciometru koja se desavaju usled pritiska na taster SW1. +*/ + +// Biblioteke za uvoz + +#include "mbed.h" + +// Definisanje makroa + +#define PERIOD_1 5 +#define SCALE 100 +#define ZERO 0 + +// Globalne promenljive + +AnalogIn pot1(PA_0); +AnalogIn pot2(PA_1); +PwmOut buzzer(PA_11); +InterruptIn sw1(PC_9); + +// Deklaracija funkcija + +void ISR_sw1(void); +void screenMux(void); + +// Glavna funkcija + +int main() +{ + // Zadatak 2 + if (pot2.read() == ZERO) + { + buzzer.period_ms(PERIOD_1)); + } + else + { + buzzer.period_ms(PERIOD_1 / pot2.read() * SCALE); + } + + // Zadatak 1 + + buzzer.write(pot1.read()); + + sw1.fall(&ISR_sw1); + while(1); + +} + +void ISR_sw1 () +{ + screenMux(); +} + +void screenMux() +{ + +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Nov 13 08:48:27 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file