latest Arduino-IRremote broken?

Status
Not open for further replies.

russdx

Well-known member
Downloaded latest source from
https://github.com/z3t0/Arduino-IRremote

But I am getting compile errors:

In file included from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.h:24:0,
from C:\Program Files (x86)\Arduino\libraries\IRremote\irISR.cpp:3:
C:\Program Files (x86)\Arduino\libraries\IRremote\irISR.cpp: In function 'void cmt_isr()':
C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:473:10: warning: unused variable 'tmp' [-Wunused-variable]
uint8_t tmp = CMT_MSC; \
^
C:\Program Files (x86)\Arduino\libraries\IRremote\irISR.cpp:20:2: note: in expansion of macro 'TIMER_RESET'
TIMER_RESET;
^
In file included from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/core_pins.h:34:0,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/wiring.h:33,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/WProgram.h:15,
from C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/Arduino.h:1,
from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:24,
from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.h:24,
from C:\Program Files (x86)\Arduino\libraries\IRremote\irRecv.cpp:1:
C:\Program Files (x86)\Arduino\libraries\IRremote\irRecv.cpp: In member function 'void IRrecv::enableIRIn()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy3/kinetis.h:1980:52: error: expression cannot be used as a function
#define CMT_CMD3 (*(volatile uint8_t *)0x40062008) // CMT Modulator Data Register Space High
^
C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:524:2: note: in expansion of macro 'CMT_CMD3'
CMT_CMD3 = 0; \
^
C:\Program Files (x86)\Arduino\libraries\IRremote\irRecv.cpp:120:2: note: in expansion of macro 'TIMER_CONFIG_NORMAL'
TIMER_CONFIG_NORMAL();
^
In file included from C:\Program Files (x86)\Arduino\libraries\IRremote\IRremote.h:24:0,
from C:\Program Files (x86)\Arduino\libraries\IRremote\irRecv.cpp:1:
C:\Program Files (x86)\Arduino\libraries\IRremote\IRremoteInt.h:473:10: warning: unused variable 'tmp' [-Wunused-variable]
uint8_t tmp = CMT_MSC; \
^
C:\Program Files (x86)\Arduino\libraries\IRremote\irRecv.cpp:125:2: note: in expansion of macro 'TIMER_RESET'
TIMER_RESET;
^
Error compiling.



Does not seem to like CMT_CMD3

any ideas? (im using teensy 3.1 with Arduino 1.6.3)

Regards
Russell Pirie
 
Any one has any luck with this library and a teensy 3.1.

I have tried all sorts of IR remotes and a few sensors I bought of ebay but none of them seem to work. They all receive data but the library can never understand the encoding and just returns FFFFFF all the time.

Is there a special type of sensor I need to use?
 

Attachments

  • 20150825_175534.jpg
    20150825_175534.jpg
    149 KB · Views: 267
Yeah i started off at that page using the source from the zip file same problem. Im 99% sure that zip is just an older version of this library. Maybe I should buy the exact sensor they are using in that example. Although I find it hard to beleave these ebay ones are all bad. When I pres buttons you can see the LED flickering away so its definitely picking up the signal.

What sensors have other people being using?
 
I've used the more up to date IRlib library with Teensy 3.1. It is basically a rewrite of IRremote that allows easier extensibility. Another user has posted a version here on the forum that has been updated to cover Teensy 3.

It works perfectly with an Apple Aluminum IR remote including pairing and unpairing.
 
Last edited:
The hardware section of the documents inside that zip are very useful! I will buy one of the recommended ir sensors and try again :)

Thank you
 
man I just can not get any life out of any ir lib or sensor or remote lol. tried 3 different libs now about 6 different remotes and about 4 different sensors

current setup using
remotes: (from above picture)
sensors: tsop4438/tsop38238 (as mention as known working ir sensors)

ir sensor out connected to pin 32 (directly)
power to +5 on teensy 3.1
ground to gnd on teensy

and all I see is this (picture)


I am at a complete loss what I am going wrong literally nothing seems to work for what should be such a simple project. Are there any kits out there that have the ir sensor / remote / source code / known to be working on teensy. Because I have to be missing some thing or making some big mistake some where to just get the same result no matter what I do.
 

Attachments

  • ir.jpg
    ir.jpg
    101.2 KB · Views: 286
I used this kit https://www.sparkfun.com/products/13235 with a Teensy 3.1 and it all just worked out of the box. I'm currently using a surface mount TSOP57238TT1 and having no problems with an Apple remote and a few generic ones I found on Amazon.

I don't remember installing any custom libraries; I just used the IRRemote that came with Teensyduino.

Is it possible you've got a library conflict somewhere? Maybe you've got a version in your home directory and another in the main Arduino directory?

I am on the road until Thursday evening but when I get home I can tell you exactly which version of IRRemote I'm using, if you can't get it working.
 
Yeah it says the remote uses the NEC protocol what is all these other ebay remote I have bought should be using. Maybe they have a tweaked version of the protocol because I am deffo getting data from the library / sensor just fails to decode it.

My phone has an ir sensor on it with an app that has over 200 different protocols. the NEC one never works.

Yeah when your free if you could explain your setup maybe I can try and replicate it and go from there :)

Thanks
 
Looks like I need to dig into IRremote again! The copy in Teensyduino works great, but it is pretty old. Even a couple years ago it lacked decoding for newer protocols.

I'm working on a couple other projects at the moment, so I realistically can't dig into IRremote stuff for a while. But in the meantime, I *can* start acquiring a few more remotes for testing. Currently, the only one I have is an old Sony 5-disc CD changer.

Any ideas which remotes I should get for testing, and where specifically I should buy them? (hopefully without massive spending on expensive gear they control)
 
I acquire harmony 650 when radio shack was going out of business on sale for about $25, pretty happy with the remote.
I saved around $40 to $60.
I'm currently using it with IRremonte library and MythTV, Free Open Source software digital video recorder (DVR)

Code:
/* 
 
 MythTV IR remote USB keyboard control.
 Logitech Harmony 650 Remote
 Harmony 650 is setup as TiVo ‑ Roamio DVR Remote for my MythTV DVR.
 
 MythTV is a Free Open Source software digital video recorder (DVR),
 project distributed under the terms of the GNU GPL.
 It has been under heavy development since 2002,
 and now contains most features one would expect from a good DVR 
 (and many new ones that you soon won't be able to live without).
 Completely automatic commercial detection/skipping,
 with manual correction via an intuitive cutlist editor.
 
 Though MythTV was initially written to run only on the Linux operating system,
 BSD and MacOS X are also well supported, and it has recently become possible
 to build a version that can run on Microsoft Windows.
 We are constantly working to bring MythTV to as many users as possible,
 regardless of your preferred operating system.
 http://www.mythtv.org/detail/mythtv
 
 Based on 
 VLCremote - Sketch allows you to control a Teensyduino with an IR remote.
 The sketch reads IR codes from the remote and outputs them as keyboard presses.
 Most video players allow you to control playback via keyboard presses.
 http://www.richardosgood.com/blog/2013/11/19/remote-control-your-computer-using-arduino/
 http://www.youtube.com/watch?v=zwnt5SmBFQk
 
 
 Change the #define section below to match your remote controls IR codes.
 Use IRrecvDemo for receiving IR codes.
 Change the Keyboard.print and Keyboard.press statements to match your player controls.
 
 You must select Keyboard from the "Tools > USB Type" menu, on Teensyduino only
 
 A Nice Arduino Remote Control Tutorial:
 http://www.build-electronic-circuits.com/arduino-remote-control/
 
 Based on code by Rick Osgood
 
 Modified  5 March 2014 By  Chris O.
 ver 0.50
 Tested on: 
 Teensy 3.1 processor running at 48 / 96 Mhz 
 Arduino IDE 1.0.5 MSWINDOWS
 Teensyduino 1.19
 
 MythTV (DVR) project taught me a lot about Linux,
 It also gives me a good excuse to run a Linux server 24x7  ):

 */

#include <IRremote.h>

/* ############## YAMAHA RX-V2200 AV Receiver / IR blaster ############################################################# */
// Yamaha AV Receiver / define IR codes to be send to IR LED Transmitter [IR blaster]
#define YamPowerOn 0x5EA1B847  // YAMAHA RX-V2200 AV Receiver system power on 5EA1B847
#define YamPowerOff 0x5EA17887 // YAMAHA RX-V2200 AV Receiver stand by off 5EA17887
#define YamVolUp 0x5EA158A7    // YAMAHA RX-V2200 AV Receiver volume up 5EA158A7
#define YamVolDown 0x5EA1D827  // YAMAHA RX-V2200 AV Receiver volume down 5EA1D827

// CREATIVE RM-1800 IR remote button codes, RM-1800 Keybindings that will Transmit YAMAHA RX-V2200 AV Receiver codes.
#define CreativeRM1800ButtonPowerOnOff 0x8322619E //CREATIVE RM-1800 power button.
byte toggleYamPowerFlag = 0; // toggle on off state FLAG / YAMAHA AV Receiver remote has 2 buttons 1 for on and 1 for off.
// My CREATIVE RM-1800 remote has 1 button for power and 4 wheel buttons, 
#define CreativeRM1800Button24bitUP  0x8322926D   // 24-Bit crystalizer wheel up / will use this for YAMAHA Rec. volume up
#define CreativeRM1800Button24bitDown 0x8322936C  // 24-Bit crystalizer wheel down
/* ######################## end off IR blaster ######################################################################## */


// Harmony 650 IR remote codes
#define ESC 0xA10CB10E //Harmony 650 [exit] / RM-1800 [cancel] = ESC
// Harmony 650 Remote codes
#define Cancel 0x83227C83 //CREATIVE RM-1800 Cancel = ESC or C  exits without changing

#define Play 0xA10C840B //mythtv [Ctrl+p] / harmony 650 [play]
#define Pause 0xA10CC40B //Pause/Play  mythtv [p] / harmony 650 [play]
#define STOP 0x8322857A      //mythtv [esc] / harmony 650 [stop]
#define FORWARD 0xA10C240B //FORWARD
#define REWIND 0xA10C440B //REWIND
#define FastFORWARD 0xA10CE40B //FastFORWARD / KEY_PAGE_DOWN / MythTV JumpFFWD
#define FastREWIND 0xA10C640B //FastREWIND / KEY_PAGE_UP / MythTV JumpRWND
#define ChanUP 0xA10C7807 // ArrowUp
#define ChanDOWN 0xA10CF807 // ArrowDown
#define Menu 0xA10CB00F // todo add in jumppoint editor Alt+E
#define LiveTV 0xA10C8807 // todo add in jumppoint editor Alt+L 

// # This is only for Teensy Loader application; Teensyduino #
// TODO ############## fix this for arduino Leonardo, Micro, or Due #########################
// not tested on MAC.
#define VOLUMEUP 0x5EA158A7   //KEY_MEDIA_VOLUME_INC / WORKS ON LINUX ONLY, //mythtv [VOLUME_INC] / harmony 650 [vol+]
#define VOLUMEDOWN 0x5EA1D827 //KEY_MEDIA_VOLUME_DEC / WORKS ON LINUX ONLY //mythtv [VOLUME_DEC] / harmony 650 [vol-]
#define MUTE 0x5EA138C7 //KEY_MEDIA_MUTE / WORKS ON LINUX ONLY //mythtv [KEY_MEDIA_MUTE] / harmony 650 [mute]

//used to move the highlight point around
#define ArrowUp 0xA10C2807 //mythtv [ArrowUp] / harmony 650 [ArrowUp]
#define ArrowDown 0xA10C6807 //mythtv [ArrowDown] / harmony 650 [ArrowDown]
#define ArrowLeft 0xA10CE807
#define ArrowRight 0xA10CA807

#define SelectOK 0xA10C9807 // KEY_ENTER  Take action on the item under the highlight point
#define Enter 0xA10CCC03 // KEY_ENTER  Take action on the item under the highlight point
#define DisplayInfo 0xA10CC807 // During playback, 'I' toggles between position and show description info
#define ProgramGuide 0xA10C6C03 // S   Brings up Electronic Program Guide (EPG).
#define Recording 0xA10C040B // R  Change the current item from Recording/Not-Recording.
#define PrevChan 0x83228E71 // H Switch to the previous channel.

#define Key1 0xA10C140B // channel selection, EPG navigation, ff/rew speed setting (with stickykeys)
#define Key2 0xA10C940B
#define Key3 0xA10C540B
#define Key4 0xA10CD40B
#define Key5 0xA10C340B
#define Key6 0xA10CB40B
#define Key7 0xA10C740B
#define Key8 0xA10CF40B
#define Key9 0xA10C0C03
#define Key0 0xA10C8C03

/* Make sure this is the proper pin 
 NOTE; Teensy 3.1 anolog pins 3.3 volt only
 Teensy 3.1 digital pins are 5V tolerant
 Teensy 3.0 anolog/digital pins are 3.3 volt only
 
 Board	     Receive Pin	Transmit Pin	Timer Used	PWM Pins Disabled
 Teensy 3.1     Any	            5	             CMT	None
 Teensy 3.0	Any	            5	             CMT	None
 Teensy 2.0	Any	           10                4   	12
 Teensy 1.0	Any	           17	             1	        15, 18
 Teensy++ 2.0	Any	            1	             2   	0
 Teensy++ 1.0	Any	            1	             2   	0
 
 */
int RECV_PIN = 6; // ir receiver pin
IRrecv irrecv(RECV_PIN); // ir receiver
decode_results results; // ir receiver
IRsend irsend; // IR blaster 

byte skipflag = 0;
long previousMillis = 0;       // will store last time skipflag was updated
long interval = 100;           // interval at which to set skipflag (milliseconds)
int volumeSenderRipiter = 10;  // old for Creative RM1800

//NEC 0xFFFFFFFF = repeat code (i.e. every key will send this code after its inital code, if the button is held in).
byte repeatflag = false; 

void setup()
{
  //Serial.begin(9600); //DEBUG PRINT
  irrecv.enableIRIn(); // Start the receiver
   //irrecv.blink13(true); // debug led on pin 13
  //When used with a Leonardo or Due board, Keyboard.begin() starts emulating a keyboard connected to a computer. 
  //To end control, use Keyboard.end().
  //Keyboard.begin();
  
  //On Teensyduino only
  //You must select Keyboard from the "Tools > USB Type" menu, select Kayboard+Mouse+Joystick.
}

void loop() {
  //Serial.println(results.value, HEX);
  //delay(400);
  //results.value = 0;
  if (irrecv.decode(&results)) {
    //if ((irrecv.decode(&results)) && (skipflag == 0)) {
    //Serial.println(results.value, HEX);
    //skipflag = 1;
    switch(results.value) {

    case CreativeRM1800ButtonPowerOnOff:
      if (toggleYamPowerFlag == 0) { // 1 on  / 0 off
        delay(300); // need delay so the controling remonte is not interfecing with sending signal
        //  also Creative RM1800 remonte sends code twice
        irsend.sendNEC(YamPowerOn, 32); //sendNEC(IRcode, numBits); 32-bit NEC protocol
        delay(100);
        toggleYamPowerFlag = 1; // set flag on, ready for next time
      }
      else if (toggleYamPowerFlag == 1){
        delay(300); // need delay so the controling remonte is not interfecing with sending signal
        // also Creative RM1800 remonte sends code twice
        irsend.sendNEC(YamPowerOff, 32); //sendNEC(IRcode, numBits); 32-bit NEC protocol
        delay(100);
        toggleYamPowerFlag = 0; // set flag off, ready for next time
      }
      irrecv.enableIRIn(); // Re-enable receiver after irsend.sendNEC(0x?, 32);
      break;

    case CreativeRM1800Button24bitUP:
      delay(225); //  need delay so the controling remonte is not interfecing with sending signal

      for (int f = 0; f < volumeSenderRipiter; f++) { // send as many times as defined in volumeSenderRipiter 
        irsend.sendNEC(YamVolUp, 32); // sendNEC(IRcode, numBits); 32-bit NEC protocol
        delay(35); // need some time/space between sanded codes
      }
      irrecv.enableIRIn(); // Re-enable receiver
      break;

    case CreativeRM1800Button24bitDown:
      delay(225); //  need delay so the controling remonte is not interfecing with sending signal

      for (int m = 0; m < volumeSenderRipiter; m++) { // send as many times as defined in volumeSenderRipiter 
        irsend.sendNEC(YamVolDown, 32); // sendNEC(IRcode, numBits); 32-bit NEC protocol
        delay(35); // need some time/space between sanded codes
      }

      irrecv.enableIRIn(); // Re-enable receiver / After sending, you have to call "enableIRIn()" again.
      break;

    case ESC: // #define ESC 0x83228E71 //CREATIVE RM-1800 return = ESC
      Keyboard.press(KEY_ESC);
      delay(100);
      Keyboard.releaseAll();
      break;

    case Cancel: // #define Cancel 0x83227C83 //CREATIVE RM-1800 Cancel = ESC or C  exits without changing
      Keyboard.press(KEY_ESC);
      delay(100);
      Keyboard.releaseAll();
      break; 

    case SelectOK:
      Keyboard.press(KEY_ENTER); // Space/Enter  take action on the item under the highlight point
      delay(100);
      Keyboard.releaseAll();
      break;

    case Enter:
      Keyboard.press(KEY_ENTER); // Space/Enter  take action on the item under the highlight point
      delay(100);
      Keyboard.releaseAll();
      break;

    case ArrowUp:
      Keyboard.press(KEY_UP_ARROW); // scroll up, Live tv; channel change up, Recordings; jump rewind
      irrecv.resume(); // Receive the next value
      delay(150);
      irrecv.decode(&results); //detect repeat code
      // NOTE: NEC encoding type
      // 0xFFFFFFFF = repeat code (i.e. every key will send this code after its inital code, if the button is held in).
      if (results.value == 0xFFFFFFFF) {
          repeatflag = true; // set FLAG true if repeat code detected
        }
      while (repeatflag == true) 
      // break out of while loop only if FLAG is set false and then release Keyboard.press(KEY_UP_ARROW) / [Keyboard.releaseAll();]
      { 
        results.value = 0;
        irrecv.resume(); // Receive the next value
        delay(200);
        irrecv.decode(&results);
        if (results.value == 0xFFFFFFFF) {
          repeatflag = true;
        }
        else {
          repeatflag = false;
        }
      }
      Keyboard.releaseAll();
      break;

    case ArrowDown:
      Keyboard.press(KEY_DOWN_ARROW); // scroll down, Live tv; channel change down, Recordings; jump forward
      irrecv.resume(); // Receive the next value
      delay(150);
      irrecv.decode(&results); //detect repeat code
      // NOTE: NEC encoding type
      // 0xFFFFFFFF = repeat code (i.e. every key will send this code after its inital code, if the button is held in).
      if (results.value == 0xFFFFFFFF) {
          repeatflag = true; // set FLAG true if repeat code detected
        }
      while (repeatflag == true) 
      // break out of while loop only if FLAG is set false and then release Keyboard.press(KEY_UP_ARROW) / [Keyboard.releaseAll();]
      { 
        results.value = 0;
        irrecv.resume(); // Receive the next value
        delay(200);
        irrecv.decode(&results);
        if (results.value == 0xFFFFFFFF) {
          repeatflag = true;
        }
        else {
          repeatflag = false;
        }
      }
      Keyboard.releaseAll();
      break;

    case ArrowRight:
      Keyboard.press(KEY_RIGHT_ARROW); // scroll right, Recordings; forward
      Keyboard.releaseAll(); // slow down the repeat
      irrecv.resume(); // Receive the next value
      delay(150); // 120 min. time delay between irrecv.resume() and irrecv.decode(&results)
      irrecv.decode(&results); //detect repeat code
      irrecv.resume(); // Receive the next value
      // NOTE: NEC encoding type
      // 0xFFFFFFFF = repeat code (i.e. every key will send this code after its inital code, if the button is held in).
      if (results.value == 0xFFFFFFFF) {
          repeatflag = true; // set FLAG true if repeat code detected
        }
      while (repeatflag == true) 
      // break out of while loop only if FLAG is set false
      { 
        results.value = 0; // reset to 0
        //irrecv.resume(); // Receive the next value
        delay(130); // 120 min. time delay between irrecv.resume() and irrecv.decode(&results)
        irrecv.decode(&results);
        if (results.value == 0xFFFFFFFF) {
          repeatflag = true;
          Keyboard.press(KEY_RIGHT_ARROW); // slow down the repeat
          Keyboard.releaseAll(); // slow down the repeat
        }
        else {
          repeatflag = false;
        }
        irrecv.resume(); // Receive the next value
      }
      Keyboard.releaseAll();
      break;

    case ArrowLeft:
      Keyboard.press(KEY_LEFT_ARROW); // scroll left, Recordings; rewind
      Keyboard.releaseAll(); // slow down the repeat
      irrecv.resume(); // Receive the next value
      delay(150); // 120 min. time delay between irrecv.resume() and irrecv.decode(&results)
      irrecv.decode(&results); //detect repeat code
      irrecv.resume(); // Receive the next value
      // NOTE: NEC encoding type
      // 0xFFFFFFFF = repeat code (i.e. every key will send this code after its inital code, if the button is held in).
      if (results.value == 0xFFFFFFFF) {
          repeatflag = true; // set FLAG true if repeat code detected
        }
      while (repeatflag == true) 
      // break out of while loop if FLAG is set false
      { 
        results.value = 0; // reset to 0
        //irrecv.resume(); // Receive the next value
        delay(130); // 120 min. time delay between irrecv.resume() and irrecv.decode(&results)
        irrecv.decode(&results);
        if (results.value == 0xFFFFFFFF) {
          repeatflag = true;
          Keyboard.press(KEY_LEFT_ARROW); // slow down the repeat
          Keyboard.releaseAll(); // slow down the repeat
        }
        else {
          repeatflag = false;
        }
        irrecv.resume(); // Receive the next value
      }
      Keyboard.releaseAll();
      break;

/*  case ArrowLeft:
      Keyboard.press(KEY_LEFT_ARROW); // scroll left, Recordings; rewind
      delay(100);
      Keyboard.releaseAll();
      break; */

    case DisplayInfo:
      Keyboard.print("i"); // Information
      delay(100);
      break;

    case ProgramGuide:
      Keyboard.print("s"); // Tv Program Guide
      delay(100);
      break;

    case Recording:
      Keyboard.print("r"); // REC
      delay(100);
      break;

    case PrevChan: // 0x83228E71 // H Switch to the previous channel.
      Keyboard.press(KEY_SPACE); // save bookmark before Switching.
      delay(100);
      Keyboard.releaseAll();
      Keyboard.print("h"); // REC
      delay(100);
      break;

    case Play:
     // Keyboard.press(KEY_LEFT_CTRL),(KEY_P); // Play mythtv [Ctrl+p] / harmony 650 [Pause]
     // delay(100);
     // Keyboard.releaseAll();
      Keyboard.print("p"); // Play Pause
      delay(100);
      break;

    case Pause: //#define Pause 0xA10CC40B // mythtv [p] / harmony 650 [Pause]
      Keyboard.print("p"); // Play Pause
      delay(100);
      break;

    case STOP:
      //Keyboard.print("s"); // VLC
      Keyboard.press(KEY_ESC); // MYTH TV
      delay(100);
      Keyboard.releaseAll();
      break;

    case FORWARD:
      //Keyboard.press(KEY_LEFT_ALT);
      Keyboard.press(KEY_RIGHT_ARROW);
      delay(100);
      Keyboard.releaseAll();
      break;

    case REWIND:
      //Keyboard.press(KEY_LEFT_ALT); //VLC
      Keyboard.press(KEY_LEFT_ARROW);
      delay(100);
      Keyboard.releaseAll();
      break;

    case FastFORWARD: //#define FastFORWARD 0xA10CE40B 
      Keyboard.press(KEY_PAGE_DOWN); //MythTV JumpFFWD
      delay(100);
      Keyboard.releaseAll();
      break;

    case FastREWIND: //#define FastREWIND 0xA10C640B 
      Keyboard.press(KEY_PAGE_UP); //MythTV JumpRWND
      delay(100);
      Keyboard.releaseAll();
      break;
      
    case ChanUP:
      Keyboard.press(KEY_UP_ARROW); // scroll up, Live tv; channel change up, Recordings; jump rewind
      irrecv.resume(); // Receive the next value
      delay(150);
      irrecv.decode(&results); //detect repeat code
      // NOTE: NEC encoding type
      // 0xFFFFFFFF = repeat code (i.e. every key will send this code after its inital code, if the button is held in).
      if (results.value == 0xFFFFFFFF) {
          repeatflag = true; // set FLAG true if repeat code detected
        }
      while (repeatflag == true) 
      // break out of while loop only if FLAG is set false and then release Keyboard.press(KEY_UP_ARROW) / [Keyboard.releaseAll();]
      { 
        results.value = 0;
        irrecv.resume(); // Receive the next value
        delay(200);
        irrecv.decode(&results);
        if (results.value == 0xFFFFFFFF) {
          repeatflag = true;
        }
        else {
          repeatflag = false;
        }
      }
      Keyboard.releaseAll();
      break;
      
    case ChanDOWN:
      Keyboard.press(KEY_DOWN_ARROW); // scroll down, Live tv; channel change down, Recordings; jump forward
      irrecv.resume(); // Receive the next value
      delay(150);
      irrecv.decode(&results); //detect repeat code
      // NOTE: NEC encoding type
      // 0xFFFFFFFF = repeat code (i.e. every key will send this code after its inital code, if the button is held in).
      if (results.value == 0xFFFFFFFF) {
          repeatflag = true; // set FLAG true if repeat code detected
        }
      while (repeatflag == true) 
      // break out of while loop only if FLAG is set false and then release Keyboard.press(KEY_UP_ARROW) / [Keyboard.releaseAll();]
      { 
        results.value = 0;
        irrecv.resume(); // Receive the next value
        delay(200);
        irrecv.decode(&results);
        if (results.value == 0xFFFFFFFF) {
          repeatflag = true;
        }
        else {
          repeatflag = false;
        }
      }
      Keyboard.releaseAll(); 
      break;
      
//#define Menu 0xA10CB00F // todo add in jumppoint editor Alt+E
    case Menu:
      Keyboard.press(KEY_LEFT_ALT); //MythTV Jump to Menu
      delay(50);
      Keyboard.press(KEY_E);
      Keyboard.release(KEY_LEFT_ALT);
      delay(100);
      //Keyboard.release(KEY_LEFT_ALT);
      Keyboard.releaseAll();
      break;
      
//#define LiveTV 0xA10C8807 // todo add in jumppoint editor Alt+L 
    case LiveTV:
      Keyboard.press(KEY_LEFT_ALT); //MythTV Jump to LiveTV
      delay(50);
      Keyboard.press(KEY_L);
      delay(100);
      //Keyboard.release(KEY_LEFT_ALT);
      Keyboard.releaseAll();
      break;
    
    case VOLUMEUP:  //MythTV F11	increase volume
      Keyboard.set_media(KEY_MEDIA_VOLUME_INC);
      Keyboard.send_now();
      Keyboard.set_media(0);
      Keyboard.send_now();
      //Keyboard.press(KEY_MEDIA_VOLUME_INC);
      delay(100);
      Keyboard.releaseAll();
      break;

    case VOLUMEDOWN:  //MythTV F10	decrease volume
      Keyboard.set_media(KEY_MEDIA_VOLUME_DEC);
      Keyboard.send_now();
      Keyboard.set_media(0);
      Keyboard.send_now();
      delay(100);
      Keyboard.releaseAll();
      break;

    case MUTE: //MythTV F9	toggle mute
      Keyboard.set_media(KEY_MEDIA_MUTE);
      Keyboard.send_now();
      Keyboard.set_media(0);
      Keyboard.send_now();
      delay(100);
      Keyboard.releaseAll();
      break;     

    case Key1:
      Keyboard.print("1");
      delay(100);
      break;

    case Key2:
      Keyboard.print("2");
      delay(100);
      break;
    case Key3:
      Keyboard.print("3");
      delay(100);
      break;
    case Key4:
      Keyboard.print("4");
      delay(100);
      break;
    case Key5:
      Keyboard.print("5");
      delay(100);
      break;
    case Key6:
      Keyboard.print("6");
      delay(100);
      break;
    case Key7:
      Keyboard.print("7");
      delay(100);
      break;
    case Key8:
      Keyboard.print("8");
      delay(100);
      break;
    case Key9:
      Keyboard.print("9");
      delay(100);
      break;
    case Key0:
      Keyboard.print("0");
      delay(100);
      break;
    }
    irrecv.resume(); // Receive the next value
  }
}
 
@paul

If you apply the fix I found (in my second post) the latest version of that irRemote will compile.

I would really like this lib to work with these cheap ebay rgl led remotes as they are ideal for projects. (Im pretty sure it does work but I just cant seem to get it working lol)

Example of remotes:
http://www.ebay.co.uk/itm/Hot-Sale-...-Light-Lamp-/191250030421?hash=item2c8763df55
http://www.ebay.co.uk/itm/3Key-10Ke...Strips-/371382955618?var=&hash=item5678262e62
http://www.ebay.co.uk/itm/16-Color-...hiping-/271944112262?var=&hash=item3f5121d886
http://www.ebay.co.uk/itm/Mini-24Ke...ED-Strip-VM-/221765864281?hash=item33a2468b59
http://www.ebay.co.uk/itm/IR-Infrar...ino-AVR-PIC-/371343222490?hash=item5675c7e6da
http://www.ebay.co.uk/itm/Infrared-...For-Arduino-/221791990037?hash=item33a3d53115


be great to be able to just drop these into any project :)

from my understanding they all use the NEC protocol but the data im receiving when using a teensy 3.1 (120mhz optimized) with the latest irRemote arduino library it cant decode any of the above remotes :(. Im not sure if it does not working with these remotes? or they used a tweaked version of the NEC? or my teensy is setup wrong?

But looking at the NEC protocol it says there should be a 9ms pulse followed by a 4.5ms pulse I am not even seeing this in the debug data.
 
Ok slowly figuring this out.

One thing to note is the speed you over clock the teensy 3.1 seems to effect it. Like 120mhz NOTHING works all the timings are wrong. But on 96mhz I can get my Technika (tv) remote to work 100% using the RC5 protocol.

But all these rgb led remotes use NEC protocol. But they are random pressing same button will work say 10% of the time. It knows it NEC protocol and all the timings look correct (9ms followed by 4.5ms and 0s and 1s timings are cool) yet only works 10% of the time other 90% just shows random data. So timing must be out some where although it looks good to me?

As I write this NEC seems to work 90% of the time now
Encoding : NEC
Code : F730CF (32 bits)
Timing[68]:
-209700
+9050, -4500 + 550, - 600 + 550, - 550 + 600, - 550
+ 550, - 550 + 550, - 600 + 550, - 550 + 600, - 550
+ 550, - 550 + 600, -1650 + 550, -1700 + 550, -1650
+ 600, -1700 + 550, - 500 + 650, -1650 + 600, -1600
+ 650, -1600 + 600, - 550 + 550, - 550 + 600, -1700
+ 550, -1650 + 600, - 500 + 600, - 550 + 600, - 550
+ 550, - 550 + 600, -1650 + 600, -1650 + 550, - 550
+ 600, - 550 + 600, -1600 + 600, -1700 + 600, -1600
+ 600, -1650 + 650,
unsigned int rawData[69] = {209700, 9050,4500, 550,600, 550,550, 600,550, 550,550, 550,600, 550,550, 600,550, 550,550, 600,1650, 550,1700, 550,1650, 600,1700, 550,500, 650,1650, 600,1600, 650,1600, 600,550, 550,550, 600,1700, 550,1650, 600,500, 600,550, 600,550, 550,550, 600,1650, 600,1650, 550,550, 600,550, 600,1600, 600,1700, 600,1600, 600,1650, 650,0}; // NEC F730CF
unsigned int data = 0xF730CF;

Hmmmm I will continue to play. I would Like it to work on 120mhz though :)

Least I have a known working remote! my crappy Technika!
 
I'm not sure if you resolved your issue by changing the speed from 120Mhz to 96Mhz, but just in case here's what I'm using and seems to work. I've never modified my environment to support 120Mhz but can guarantee everything below works at 96 Mhz.

Hardware: Teensy 3.1 / 3.0

SW: Arduino 1.65 / Teensyduino 1.24

Library: From Teensyduino (C:\Program Files\Arduino\hardware\teensy\avr\libraries\IRremote in my case)

Sensors:
* TSOP38238 (through hole)
* TSOP57238TT1 (surface mount)

Remotes:
* SparkFun (https://www.sparkfun.com/products/13235)
* Apple (both white plastic and aluminum)
* Generic (http://www.amazon.com/gp/product/B0016RNSHS?psc=1&redirect=true&ref_=oh_aui_detailpage_o01_s00)
* Samsung TV

The only issue I have had with IRRemote is the weird way Apple remotes send codes. Here's the header from some code I wrote to handle them:

Code:
	// If the code starts with 0x77 0xE1 then it's an Apple Remote, which
	// sends the Apple custom code 0xEE 0x87 in least significant bit
	// first (0xEE bit reversed is 0x77, 0x87 bit reversed is 0xE1)
	// 
	// The 3rd byte is the command, except for the highest bit, which
	// is parity of command + ID
	//
	// The 4th byte is the remote ID, different from remote to remote
	// so you can have multiple Apple remotes controlling multiple Apple
	// devices in the same room. This data is from
	// http://en.wikipedia.org/wiki/Apple_Remote#Technical_details
	// 
	// If using a newer (aluminum) Apple Remote then both center
	// and play generate code 0x04 but send 0x5E (center) or 0x5C (play)
	// before
 
Last edited:
Hello :)

Yes all working now using 96mhz setting. Wonder why 120 does not work? All the internal clocks are readjusted to the new clock speed?

Im using same IR sensor as you and it works great. Ill try put all my other ones as well.

NEC cheap ebay remotes work 95% of the time but the rc5 is 100% not sure if this is due to higher quality remote (it is lol) or protocol less prone to errors?
 
Hi,

For what its worth, the technique I always use is to not try and decode the IR received codes but to just use the raw IR data codes from the IRRemote library directly and make my own code to function assignments. This seems to be 100% reliable for the IR remote controls I have used in my projects.
 
teensy 3 CMT with F_BUS 60mhz

Hello :)

Yes all working now using 96mhz setting. Wonder why 120 does not work?

I think IRremote lib for Teensy 3 (and probably 3++) needs to have additional logic added to support F_BUS at 60MHz or issue a compiler warning. The current logic assumes 48 or 24mhz and chooses a divider so that the CMT clock is running at 1 mhz. Carrier frequency and the 50us interrupt assume the 1mhz clock. The CMT hardware has divide-by-8 logic, so the 60mhz bus clock will be problematic.

possible configuration changes discussed earlier in
https://forum.pjrc.com/threads/26331-IRRemote-issues?p=52316&viewfull=1#post52316
 
Last edited:
If anyone's still watching this old thread, IRremote has been fixed and updated to work at any speed 8 MHz or higher.
 
Status
Not open for further replies.
Back
Top