tim010 tim010
/
LV5_Grupa7_Tim010_Zadatak1
Nedim Hozić
main.cpp@0:261cbee034b3, 2014-04-03 (annotated)
- Committer:
- tim010
- Date:
- Thu Apr 03 16:59:34 2014 +0000
- Revision:
- 0:261cbee034b3
LV5 - PAI - Grupa 7 - Tim010 - Zadatak1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim010 | 0:261cbee034b3 | 1 | #include "mbed.h" |
tim010 | 0:261cbee034b3 | 2 | #include "math.h" |
tim010 | 0:261cbee034b3 | 3 | #define f 200 |
tim010 | 0:261cbee034b3 | 4 | #define pi 3.14 |
tim010 | 0:261cbee034b3 | 5 | |
tim010 | 0:261cbee034b3 | 6 | AnalogOut izlaz(PTE30); |
tim010 | 0:261cbee034b3 | 7 | Ticker t; |
tim010 | 0:261cbee034b3 | 8 | float korak = 0.0001; |
tim010 | 0:261cbee034b3 | 9 | float omega = 2*pi*f; |
tim010 | 0:261cbee034b3 | 10 | |
tim010 | 0:261cbee034b3 | 11 | int i=0; |
tim010 | 0:261cbee034b3 | 12 | |
tim010 | 0:261cbee034b3 | 13 | void funkcija() |
tim010 | 0:261cbee034b3 | 14 | { |
tim010 | 0:261cbee034b3 | 15 | izlaz = (1/3.3)*abs(sin(omega*i*korak)); |
tim010 | 0:261cbee034b3 | 16 | i++; |
tim010 | 0:261cbee034b3 | 17 | if(i==100) |
tim010 | 0:261cbee034b3 | 18 | i=0; |
tim010 | 0:261cbee034b3 | 19 | } |
tim010 | 0:261cbee034b3 | 20 | |
tim010 | 0:261cbee034b3 | 21 | int main() { |
tim010 | 0:261cbee034b3 | 22 | |
tim010 | 0:261cbee034b3 | 23 | t.attach(&funkcija, korak); |
tim010 | 0:261cbee034b3 | 24 | while(1) { |
tim010 | 0:261cbee034b3 | 25 | |
tim010 | 0:261cbee034b3 | 26 | } |
tim010 | 0:261cbee034b3 | 27 | } |