This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
Capturar comandos del mando a distancia
#1
Estoy intentando capturar los códigos de un mando a distancia con un arduino YUN. Utilizo la librería NECIRrcv pero tengo un problema. A la hora de compilar los muchos ejemplos que me he encontrado todos me dan errores.

Código:
Build options changed, rebuilding all
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp: In member function 'void NECIRrcv::begin()':
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:15:3: error: 'TCCR2A' was not declared in this scope
   TCCR2A = 0;  // normal mode
   ^
In file included from /Arduino/hardware/tools/avr/avr/include/avr/io.h:99:0,
                 from /Arduino/hardware/tools/avr/avr/include/avr/pgmspace.h:88,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28,
                 from C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:4:
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:20:7: error: 'TCCR2B' was not declared in this scope
   cbi(TCCR2B,CS22) ;
       ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:20:3: note: in expansion of macro 'cbi'
   cbi(TCCR2B,CS22) ;
   ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:20:14: error: 'CS22' was not declared in this scope
   cbi(TCCR2B,CS22) ;
              ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:20:3: note: in expansion of macro 'cbi'
   cbi(TCCR2B,CS22) ;
   ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:21:14: error: 'CS21' was not declared in this scope
   sbi(TCCR2B,CS21) ;
              ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:21:3: note: in expansion of macro 'sbi'
   sbi(TCCR2B,CS21) ;
   ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:22:14: error: 'CS20' was not declared in this scope
   cbi(TCCR2B,CS20) ;
              ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:22:3: note: in expansion of macro 'cbi'
   cbi(TCCR2B,CS20) ;
   ^
In file included from C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:5:0:
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.h:33:22: error: 'TCNT2' was not declared in this scope
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT2
                      ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:27:3: note: in expansion of macro 'RESET_TIMER2'
   RESET_TIMER2;
   ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp: In function 'void TIMER2_OVF_vect()':
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.h:33:22: error: 'TCNT2' was not declared in this scope
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT2
                      ^
C:\Users\Manuel\Documents\Arduino\libraries\NECIRrcv\NECIRrcv.cpp:83:3: note: in expansion of macro 'RESET_TIMER2'
   RESET_TIMER2 ;

Lo curioso es que si selecciono la placa Arduino Uno en vez de YUN compila perfectamente.

Lo he intentado con otra libreria llamada IRremote, by Ken Shirriff pero tambien tengo problemas
Código:
sketch_nov27a.ino:33:1: error: 'Ex' does not name a type

¿Alguien me echa un cable?

Saludos¡¡¡
  Responder
#2
Muy buenas paisano!

Échale un vistazo a este hilo, parece que tienen el mismo problema que tu: http://forum.arduino.cc/index.php?topic=8494.5
  Responder
#3
yo use la libreria arduino IRremote de aqui
https://github.com/shirriff/Arduino-IRremote

Me funciona perfectamente en UNO.

Aqui una entrada de mi blog (que actualizo cada seis meses)

http://montarelpollo.blogspot.com.es/201...ia-ir.html
  Responder
#4
He hecho exactamente lo que pones en el blog con tu código y me que devuelve el siguiente error:

Código:
C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:5:16: error: 'TKD2' was not declared in this scope
int RECV_PIN = TKD2; // the pin the IR receiver is connected to
^

¿Sabes de que puede ser? ¿Porque hace referencia a la carpeta RobotIRremote si la libreria está en la carpeta Arduino-IRremote-master??

Saludos¡¡¡
  Responder
#5
¿Has declarado TKD2?

En mi código no aparece. Mi linea es

int RECV_PIN = 3; //Definimos el pin donde tiene que esta el IR
  Responder
#6
Hola, al final lo solucioné borrando la carpeta RobotoIRremote de las librerías de arduino. Ya puedo leer los comandos pero me encuentro con el siguiente problema, el mando de la tele y del satélite cada tecla me devuelve un valor, sin embargo el del aire acondicionado que es el que necesito siempre me devuelve lo mismo:

Código:
-13562
-1
-1
-1

¿¿Será que utiliza otro protocolo?? El receptor ir lo cogí de un tdt que no funcionaba.

Saludos¡¡¡
  Responder
#7
¿Te devuelve siempre un -13562?
  Responder
#8
Exacto,cualquier tecla que pulse del AC devuelve -13562 y los -1

Saludos¡¡¡
  Responder
#9
Código:
void loop() {
  // put your main code here, to run repeatedly:
if (irrecv.decode(&results)) {
    if (results.decode_type == NEC) {
      Serial.print("NEC: ");
    } else if (results.decode_type == SONY) {
      Serial.print("SONY: ");
    } else if (results.decode_type == RC5) {
      Serial.print("RC5: ");
    } else if (results.decode_type == RC6) {
      Serial.print("RC6: ");
    } else if (results.decode_type == UNKNOWN) {
      Serial.print("UNKNOWN: ");
    }
    Serial.println(results.value, HEX);
    irrecv.resume(); // Receive the next value
  }
}

Devuelve
Código:
UNKNOWN: B3E2CB06
FFFFFFFF
FFFFFFFF
FFFFFFFF

Se supone que no es compatible la libreria con el protocolo del mando del AC ???

Saludos¡¡
  Responder


Posibles temas similares…
Tema Autor Respuestas Vistas Último mensaje
  Mover mi camara con mi cabeza a distancia nolocrema 2 620 24-08-2021, 08:07 PM
Último mensaje: nolocrema
  Problema con bluetooth y comandos AT sejiozosky 41 17,481 06-05-2018, 11:48 AM
Último mensaje: Iván
  medidor de distancia a con bluetooth o wiffi homer32 4 3,107 28-10-2017, 11:28 AM
Último mensaje: homer32
  El mando pantalla 16*4 gira al reves. scesar 8 4,316 07-01-2017, 06:52 PM
Último mensaje: scesar
  LCD sensor distancia numeros de varias cifras Asclem 10 3,807 31-07-2015, 11:11 AM
Último mensaje: calpanxo