Alexandre Proulx
/
S5_info_APP1_Examen
Examen pratique info S5
Revision 0:23d910ab014b, committed 2013-01-18
- Comitter:
- Alegrowin
- Date:
- Fri Jan 18 19:31:27 2013 +0000
- Commit message:
- Functionnel V1.0
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jan 18 19:31:27 2013 +0000 @@ -0,0 +1,40 @@ +#include "mbed.h" + +AnalogOut an_Out(p18); +Ticker timer; + +void Sinus(void); +void calculateSinus(); + +int temp = 2500; +float sins[5000]; + +int main() +{ + calculateSinus(); + + timer.attach(&Sinus, 0.000002); + + while(1) { + wait(1); + } + +} + +void calculateSinus() +{ + int a; + for(a = 0;a<5000;a++) + { + sins[a] = cos(a/5000.0*2.0*3.1416)/2+.5; + } +} + + +void Sinus (void) +{ + an_Out.write(sins[temp++]); + + if(temp == 5000) + temp =0; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Jan 18 19:31:27 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/0480438fc29c \ No newline at end of file