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 0:86c0c1652dd4, committed 2017-03-18
- Comitter:
- tony63
- Date:
- Sat Mar 18 00:59:20 2017 +0000
- Child:
- 1:69f833c768c8
- Commit message:
- CAPTURAS DE C?DIGOS IRDA SIN OSCILOSCOPIO, MIDE LA CANTIDAD DE ESPACIOS EN MODO NORMAL LA DURACI?N Y EL PROMEDIO DE ELLOS. CON LA AYUDA DE PULSAR BAJO UN BOT?N DEVUELVE EL CODIGO COMPLETO
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Pulse1.lib Sat Mar 18 00:59:20 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tony63/code/Pulse1/#48651f86a80c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Mar 18 00:59:20 2017 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+#include <Pulse1.h>
+PulseInOut irda(PTD5);// en este puerto se pone el sensor infrarrojo
+
+Serial pc(USBTX, USBRX);
+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 dato; // tiempo de cada dato que se lee
+int pul_low;
+int i,j,k,header,proL,proH;
+int r;
+int main(){
+Timer t;
+fflush( stdin );
+lop1: header = irda.read_low_us();
+ if(header>8000) goto seguir;
+ goto lop1;
+seguir:
+ for(i=0;i<35;++i){
+ if(mode){
+ numN[i] = irda.read_low_us(); //funcion para leer un pulso de caida o bajo en header
+ }
+ if(!mode){
+ numP[i] = irda.read_high_us(); //funcion para leer un pulso de caida o bajo en header
+ }
+ //funcion para leer un pulso de caida o bajo en header
+ }
+
+ pc.printf("Header=%d \n",header," uS");
+ for(i=0;i<36;++i){
+ pc.printf(",%d, %d, %d \n",numN[i],i,numP[i]);
+
+ if(numN[i]>8000){
+ pc.printf("\n");
+ pc.printf("espacios=%d\n",i);
+ k=i;
+ proL=0;
+ for(i=0;i<k;++i){
+ proL=proL+numN[i];
+ }
+ proL=proL/k;
+ pc.printf("promedio_E=%d\n",proL);
+ wait(3);
+ pc.printf("\n");
+
+ if(!mode){
+ for(i=0;i<k-1;++i){
+ if(numP[i]>(2*proL)){
+ pc.printf("1");
+ }
+ if(numP[i]<(2*proL)){
+ pc.printf("0");
+ }
+ }
+ }
+
+ goto lop1;
+
+ }
+ }
+ }
+
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Mar 18 00:59:20 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/093f2bd7b9eb \ No newline at end of file