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.
Revision 1:69f833c768c8, committed 2017-03-18
- Comitter:
- tony63
- Date:
- Sat Mar 18 07:53:22 2017 +0000
- Parent:
- 0:86c0c1652dd4
- Child:
- 2:d189b5862909
- Commit message:
- se agrego una rutina que transforma el binario en un c?digo decimal pero la cifra desborda esa es la causa de el valor negativo
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Mar 18 00:59:20 2017 +0000
+++ b/main.cpp Sat Mar 18 07:53:22 2017 +0000
@@ -6,14 +6,16 @@
DigitalOut led(LED1);
DigitalOut led2(LED2);
DigitalIn mode(PTD0);
-int numN[70];//cadena para almacenar todos los tiempos que conforman los bits de datos
-int numP[70];//cadena para almacenar todos los tiempos que conforman los bits de datos
+int numN[35];//cadena para almacenar todos los tiempos que conforman los bits de datos
+int numP[35];//cadena para almacenar todos los tiempos que conforman los bits de datos
+int bin[35];//cadena para almacenar todos los tiempos que conforman los bits de datos
int dato; // tiempo de cada dato que se lee
int pul_low;
int i,j,k,header,proL,proH;
-int r;
+int r;
+int code;
int main(){
-Timer t;
+
fflush( stdin );
lop1: header = irda.read_low_us();
if(header>8000) goto seguir;
@@ -49,18 +51,24 @@
if(!mode){
for(i=0;i<k-1;++i){
if(numP[i]>(2*proL)){
- pc.printf("1");
+ bin[i]=1;
+ for(j=0;j<i+1;++j){bin[i]=bin[i]*2;}
+ //pc.printf("%d-",bin[i]);
}
if(numP[i]<(2*proL)){
- pc.printf("0");
+ bin[i]=0;
+ //pc.printf("%d-",bin[i]);
}
}
}
-
+ for(i=0;i<k-1;++i){code=code+bin[i];}
+ pc.printf("\n");
+ pc.printf("code=%d",code);
+ code=0;
goto lop1;
}
}
}
-
\ No newline at end of file
+ //for(j=0;j<i;++j)
\ No newline at end of file