tim003 tim003
/
z1
Amra Dautbegovic Elma Gazetic
main.cpp@0:251bd641d619, 2014-03-31 (annotated)
- Committer:
- tim003
- Date:
- Mon Mar 31 16:48:02 2014 +0000
- Revision:
- 0:251bd641d619
LV5_PAI_Grupa4_Tim003_Zadatak_1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tim003 | 0:251bd641d619 | 1 | #include "mbed.h" |
tim003 | 0:251bd641d619 | 2 | #include "math.h" |
tim003 | 0:251bd641d619 | 3 | #define PI 3.14159265358 |
tim003 | 0:251bd641d619 | 4 | |
tim003 | 0:251bd641d619 | 5 | |
tim003 | 0:251bd641d619 | 6 | AnalogOut ispis(PTE30); |
tim003 | 0:251bd641d619 | 7 | float step=0.0002; |
tim003 | 0:251bd641d619 | 8 | Ticker t; |
tim003 | 0:251bd641d619 | 9 | int freq(100); |
tim003 | 0:251bd641d619 | 10 | int x=0; |
tim003 | 0:251bd641d619 | 11 | |
tim003 | 0:251bd641d619 | 12 | void PodignutiSinus() { |
tim003 | 0:251bd641d619 | 13 | |
tim003 | 0:251bd641d619 | 14 | ispis=0.5+ 0.5* sin (2*PI*freq*step*x); |
tim003 | 0:251bd641d619 | 15 | |
tim003 | 0:251bd641d619 | 16 | x++; |
tim003 | 0:251bd641d619 | 17 | if (x>50) x=0; |
tim003 | 0:251bd641d619 | 18 | } |
tim003 | 0:251bd641d619 | 19 | |
tim003 | 0:251bd641d619 | 20 | |
tim003 | 0:251bd641d619 | 21 | int main() |
tim003 | 0:251bd641d619 | 22 | { |
tim003 | 0:251bd641d619 | 23 | t.attach_us(&PodignutiSinus, 200); |
tim003 | 0:251bd641d619 | 24 | } |