Puchogenso
Dependencies: mbed-rtos mbed C12832
main.cpp@1:6f592335f935, 2017-11-07 (annotated)
- Committer:
- Sumobot
- Date:
- Tue Nov 07 16:29:27 2017 +0000
- Revision:
- 1:6f592335f935
- Parent:
- 0:2124db616035
Xop
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sumobot | 1:6f592335f935 | 1 | #include "mbed.h" |
Sumobot | 1:6f592335f935 | 2 | #include "rtos.h" |
Sumobot | 1:6f592335f935 | 3 | #include "C12832.h" |
LuisFernandoTuzo | 0:2124db616035 | 4 | |
Sumobot | 1:6f592335f935 | 5 | C12832 lcd(p5, p7, p6, p8, p11); |
LuisFernandoTuzo | 0:2124db616035 | 6 | Timer t; |
Sumobot | 1:6f592335f935 | 7 | float Xop[4]; |
Sumobot | 1:6f592335f935 | 8 | float Hop[4]; |
Sumobot | 1:6f592335f935 | 9 | int h, f=-3; |
Sumobot | 1:6f592335f935 | 10 | float a=0, b, c=0, d=0, e=0, w=0, g=0, r=0, s=0, z=0, u=0, v=0, x=0, y=0; |
Sumobot | 1:6f592335f935 | 11 | Thread Muestreo, senal; |
LuisFernandoTuzo | 0:2124db616035 | 12 | AnalogOut Aout(p18); |
LuisFernandoTuzo | 0:2124db616035 | 13 | |
Sumobot | 1:6f592335f935 | 14 | void seno() {} |
Sumobot | 1:6f592335f935 | 15 | |
Sumobot | 1:6f592335f935 | 16 | |
Sumobot | 1:6f592335f935 | 17 | |
LuisFernandoTuzo | 0:2124db616035 | 18 | int main () { |
Sumobot | 1:6f592335f935 | 19 | lcd.cls(); |
Sumobot | 1:6f592335f935 | 20 | lcd.locate(0,3); |
Sumobot | 1:6f592335f935 | 21 | senal.start(seno); |
Sumobot | 1:6f592335f935 | 22 | |
Sumobot | 1:6f592335f935 | 23 | for (int i = 0; i<5; i++){ |
Sumobot | 1:6f592335f935 | 24 | b=3*sin(2000*3.1416*i*0.000125); |
Sumobot | 1:6f592335f935 | 25 | Aout = b; |
Sumobot | 1:6f592335f935 | 26 | Xop[i]= b; |
Sumobot | 1:6f592335f935 | 27 | Thread::wait(.125); |
Sumobot | 1:6f592335f935 | 28 | //lcd.printf("El valor es %.2f", Xop[1]); |
Sumobot | 1:6f592335f935 | 29 | } |
Sumobot | 1:6f592335f935 | 30 | |
Sumobot | 1:6f592335f935 | 31 | for (int j = 3; j>-1; j--){ |
Sumobot | 1:6f592335f935 | 32 | h= 2*j; |
Sumobot | 1:6f592335f935 | 33 | Hop[f]=h; |
Sumobot | 1:6f592335f935 | 34 | //lcd.printf("El valor es %.2f", Hop[f]); |
Sumobot | 1:6f592335f935 | 35 | f=f+1; |
Sumobot | 1:6f592335f935 | 36 | } |
Sumobot | 1:6f592335f935 | 37 | |
Sumobot | 1:6f592335f935 | 38 | Thread::wait(3000); |
Sumobot | 1:6f592335f935 | 39 | |
Sumobot | 1:6f592335f935 | 40 | //for (int k = 1; k<3; k++) { |
Sumobot | 1:6f592335f935 | 41 | lcd.printf("El valor es %.1f", Xop[0]); |
Sumobot | 1:6f592335f935 | 42 | lcd.printf("El valor es %.1f", Xop[1]); |
Sumobot | 1:6f592335f935 | 43 | lcd.printf("El valor es %.1f", Xop[2]); |
Sumobot | 1:6f592335f935 | 44 | lcd.printf("El valor es %.1f", Xop[3]); |
Sumobot | 1:6f592335f935 | 45 | |
Sumobot | 1:6f592335f935 | 46 | /*d = d + c; |
Sumobot | 1:6f592335f935 | 47 | } |
Sumobot | 1:6f592335f935 | 48 | for (int k = -3; k<7; k++) { |
Sumobot | 1:6f592335f935 | 49 | e = X[k]*Hop[k-3]; |
Sumobot | 1:6f592335f935 | 50 | //lcd.printf("El valor es %.1f", e); |
Sumobot | 1:6f592335f935 | 51 | w = w + e; |
LuisFernandoTuzo | 0:2124db616035 | 52 | } |
Sumobot | 1:6f592335f935 | 53 | for (int k = -3; k<7; k++) { |
Sumobot | 1:6f592335f935 | 54 | g = X[k]*Hop[k-4]; |
Sumobot | 1:6f592335f935 | 55 | //lcd.printf("El valor es %.1f", g); |
Sumobot | 1:6f592335f935 | 56 | r = r + g; |
Sumobot | 1:6f592335f935 | 57 | } |
Sumobot | 1:6f592335f935 | 58 | for (int k = -3; k<7; k++) { |
Sumobot | 1:6f592335f935 | 59 | s = X[k]*Hop[k-5]; |
Sumobot | 1:6f592335f935 | 60 | //lcd.printf("El valor es %.1f", s); |
Sumobot | 1:6f592335f935 | 61 | z=z+s; |
Sumobot | 1:6f592335f935 | 62 | } |
Sumobot | 1:6f592335f935 | 63 | for (int k = -3; k<7; k++) { |
Sumobot | 1:6f592335f935 | 64 | u = X[k]*Hop[k-6]; |
Sumobot | 1:6f592335f935 | 65 | //lcd.printf("El valor es %.1f", u); |
Sumobot | 1:6f592335f935 | 66 | v=v+u; |
Sumobot | 1:6f592335f935 | 67 | } |
Sumobot | 1:6f592335f935 | 68 | for (int k = -3; k<7; k++) { |
Sumobot | 1:6f592335f935 | 69 | x = X[k]*Hop[k-7]; |
Sumobot | 1:6f592335f935 | 70 | //lcd.printf("El valor es %.1f", x); |
Sumobot | 1:6f592335f935 | 71 | y=y+x; |
Sumobot | 1:6f592335f935 | 72 | }*/ |
Sumobot | 1:6f592335f935 | 73 | while (1) { |
Sumobot | 1:6f592335f935 | 74 | //lcd.printf("El valor es %.f", d); |
Sumobot | 1:6f592335f935 | 75 | /*lcd.printf("El valor es %.1f", w); |
Sumobot | 1:6f592335f935 | 76 | lcd.printf("El valor es %.1f", r); |
Sumobot | 1:6f592335f935 | 77 | lcd.printf("El valor es %.1f", z); |
Sumobot | 1:6f592335f935 | 78 | lcd.printf("El valor es %.1f", v); |
Sumobot | 1:6f592335f935 | 79 | lcd.printf("El valor es %.1f", y);*/ |
LuisFernandoTuzo | 0:2124db616035 | 80 | } |
LuisFernandoTuzo | 0:2124db616035 | 81 | } |