Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:55dd7742a7b7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 26 11:25:49 2018 +0000 @@ -0,0 +1,34 @@ +#include "mbed.h" + +Serial pc(USBTX,USBRX); + +AnalogIn ulaz(PTC1); +AnalogOut izlaz(PTE30); + +const double pi=3.141592653589793238462; + +Ticker t; +double omega, T; +double frekvencija1, frekvencija2; +double a, b, x0, y0, y1; + +void diferentna() { + x0=ulaz; + y0=a*y1+b*x0; + izlaz=y0; + y1=y0; +} + +int main() { + pc.baud (115200); + pc.printf("Unesite granicnu frekvenciju: "); + pc.scanf("%lf", &frekvencija1); + omega=2*pi*frekvencija1; + T=1./(20*frekvencija1); + a=1/(omega*T+1); + b=(omega*T)/(1+omega*T); + y1=0; //NPU + t.attach(&diferentna, T); + while(1); +} +