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.
Dependencies: Pulse1 TextLCD-modificad mbed
Revision 0:ed00d6af5f8d, committed 2015-04-29
- Comitter:
- obifandres
- Date:
- Wed Apr 29 05:08:19 2015 +0000
- Commit message:
- Tarea5 Irda
Changed in this revision
diff -r 000000000000 -r ed00d6af5f8d Pulse1.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Pulse1.lib Wed Apr 29 05:08:19 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/tony63/code/Pulse1/#48651f86a80c
diff -r 000000000000 -r ed00d6af5f8d TextLCD-modificad.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD-modificad.lib Wed Apr 29 05:08:19 2015 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/salondonog/code/TextLCD-modificad/#d5c3eb2b8d0e
diff -r 000000000000 -r ed00d6af5f8d main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Apr 29 05:08:19 2015 +0000
@@ -0,0 +1,63 @@
+#include "mbed.h"
+#include <Pulse1.h>
+#include "TextLCD.h"
+
+TextLCD lcd(PTB10, PTB11, PTE2, PTE3, PTE4, PTE5);  //configura los puestos PTE0,PTE1,PTE2,PTE3,PTE4,PTE5, donde se conectara el LCD 16x2 
+PulseInOut irda(PTD5);// en este puerto se pone el sensor infrarrojo
+Serial pc(USBTX, USBRX);
+DigitalOut led2_G(LED2);
+DigitalOut led2_R(LED3);
+DigitalOut led2_B(LED1);
+int header =0; //tiempo de cabecera pulso abajo
+const int head_H = 2430*1.2; //+20% medida con osciloscopio en microsegundos
+const int head_L = 2430*0.8;//-20%  medida con osciloscopio
+int i=0;
+int n=0;
+const int T_alto=1170;//ponga su tiempo de la prueba
+const int T_bajo=567;//ponga su tiempo de la prueba
+const int num_bits = 12;//ponga su numero de bits
+int arreglo[num_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(){
+    lcd.cls();
+while(1){
+ini1: header=0;
+          
+      header = irda.read_low_us();    //funcion para leer un pulso de caida o bajo
+         
+      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
+      lcd.locate(0,1);
+      lcd.printf("            ");
+      lcd.locate(0,1);      
+      wait_us(1650/2);
+      for(i=0;i<(num_bits);++i){ // POR OSCILOSCOPIO se determina que llegan (num_bits),datos
+      dato = irda.read_low_us(); //leer un bit de datos que es pulso abajo en este control
+      num[i]=dato;
+      wait_us(550/2);   
+      }
+      wait(0.5); //espero un poquito antes de leer todo el arreglo y ponerlo en pantalla 
+      for(i=0;i<(num_bits);++i){  
+      if(num[i] > ((T_alto+T_bajo)/2)){ 
+      arreglo[i]=1;
+      lcd.printf("%d",arreglo[i]); 
+      }
+      else{
+      arreglo[i]=0; 
+      lcd.printf("%d",arreglo[i]); 
+      }
+      }
+      lcd.locate(0,0);  
+      lcd.printf("h=%dus",header);
+      lcd.locate(8,0);
+      lcd.printf("        ");
+      lcd.locate(8,0);
+      lcd.printf("T=%dus",dato); 
+   }
+ }
\ No newline at end of file
diff -r 000000000000 -r ed00d6af5f8d mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Apr 29 05:08:19 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/433970e64889 \ No newline at end of file