Fahrudin Brbutovic Orhan Ljubuncic
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 00004 #define broj_step 5 00005 #define PI 3.142 00006 00007 00008 00009 AnalogOut osc(PTE30); 00010 Ticker t; 00011 00012 00013 00014 00015 int brojac(0); 00016 00017 00018 void sinus() 00019 { 00020 if(brojac < broj_step) 00021 { 00022 osc = (1/3.3) * abs(sin (2*PI * 1000 * 200e-6 * (float)brojac)); 00023 brojac++; 00024 } 00025 else brojac = 0; // novi period 00026 00027 } 00028 00029 00030 /*void ispis() 00031 { 00032 osc = value/3.3; 00033 if(uzlazno) 00034 value = value + 0.1; 00035 else value = value - 0.1; 00036 if(value>=1.0) uzlazno = false; 00037 else if(value <= 0.0) uzlazno = true; 00038 } 00039 00040 */ 00041 00042 00043 int main() 00044 { 00045 00046 t.attach_us(&sinus, 200); 00047 00048 while(1); 00049 }
Generated on Sun Oct 9 2022 01:23:18 by
1.7.2