tim003 tim003
/
z2
Amra Dautbegovic Elma Gazetic
Fork of z1 by
Diff: main.cpp
- Revision:
- 1:fd86377b4b68
- Parent:
- 0:251bd641d619
--- a/main.cpp Mon Mar 31 16:48:02 2014 +0000 +++ b/main.cpp Mon Mar 31 17:29:50 2014 +0000 @@ -1,24 +1,22 @@ + #include "mbed.h" -#include "math.h" -#define PI 3.14159265358 - - -AnalogOut ispis(PTE30); -float step=0.0002; -Ticker t; -int freq(100); -int x=0; - -void PodignutiSinus() { - -ispis=0.5+ 0.5* sin (2*PI*freq*step*x); - - x++; - if (x>50) x=0; +PwmOut pwm(dp18); +AnalogIn ulaz(dp9); + +int main() { + float potenc = ulaz; + pwm.period_us(200); + + int i = 0; + + while(1) { + if(i%100==0) + { + potenc = ulaz; + i = 1; + pwm = potenc; + } + i++; + + } } - - -int main() -{ - t.attach_us(&PodignutiSinus, 200); -}