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.
Fork of irda_V_aula by
Revision 4:da7d9b4fb90a, committed 2016-04-25
- Comitter:
 - SSJprocesa
 - Date:
 - Mon Apr 25 20:09:07 2016 +0000
 - Parent:
 - 3:82bebaf2a06a
 - Commit message:
 - Obtener y comparar los pulsos de un control remoto para activar una v?lvula.
 
Changed in this revision
| main.cpp | Show diff for this revision Revisions of this file | 
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file | 
--- a/main.cpp	Thu May 08 00:38:39 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#include "mbed.h"
-#include <Pulse1.h>
-//control remoto videobeam aula
-PulseInOut irda(PTD5);// en este puerto se pone el sensor infrarrojo
-Serial pc(USBTX, USBRX);
-DigitalOut led(LED1);
-DigitalOut led2(LED2);
-int header =0; //tiempo de cabecera pulso abajo
-const int head_H = 9120; //+10% medida con osciloscopio en microsegundos
-const int head_L = 8939;//-10%  medida con osciloscopio
-int i=0;
-const int T_alto=1630;//ponga su tiempo de la prueba
-const int T_bajo=533;//ponga su tiempo de la prueba
-const int num_bits = 64;//ponga su numero de bits
-int num[num_bits];//cadena para almacenar todos los tiempos que conforman los bits de datos
-int dato; // tiempo de cada dato que se lee
-  
-int main(){
-while(1){
-ini1: fflush( stdin );
-      header=0;
-      led2=1;
-      led=1;
-      header = irda.read_low_us();    //funcion para leer un pulso de caida o bajo en header
-      if (header > head_L && header < head_H) goto seguir;//verificar que este en la tolerancia +-20%
-      else goto ini1;
-      
-seguir:
-       //leo los datos de la trama y se meten a un arreglo
-      wait_us(4500);// ES EL TIEMPO DE HEADER QUE NO SE Lee O EL ALTO 
-      led2=0;
-      for(i=0;i<(num_bits-1);++i){ // POR OSCILOSCOPIO se determina que llegan (num_bits),datos
-      dato = irda.read_high_us(); //leer un bit de datos que es pulso arriba en este control
-      num[i]=dato;
-      wait_us(300);   
-      }
-      wait(0.5); //espero un poquito luego de leer todo el arreglo y ponerlo en pantalla 
-      pc.printf(",%d",header);
-      for(i=0;i<(num_bits-1);++i){  
-      pc.printf(",%d",num[i]);
-      }
-      wait(0.1);  //espero e imprimo en binario 
-      pc.printf("\n\n");
-      for(i=0;i<(num_bits-1);++i){  
-      if(num[i] > ((T_alto+T_bajo)/2)) pc.printf("1");
-      else pc.printf("0");
-      }
-      }
-      }
\ No newline at end of file
--- a/mbed.bld Thu May 08 00:38:39 2014 +0000 +++ b/mbed.bld Mon Apr 25 20:09:07 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/f37f3b9c9f0b \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/99a22ba036c9 \ No newline at end of file
