New IRremote library

Can anyone point me to a published sketch using the new IRremote version 31 that will enable sending a simple Sony12 infrared remote signal? I've been doing that for years by having my NANO trigger the transmission from a standard TV remote control. Doing it directly from the MCU would be much more efficient, less expensive, more reliable, etc.

The library examples are no help?

Try using the ReceiveDump example (File->Examples->IRremote->RTeceiveDump). That should show you how to send the received signal. Play your current remote at it and write code to send that same command.

Many thanks to johnwasser and grounfFungus. I'll see if I can understand the examples. I don't need to receive the signal I want to send. I already know the protocol and command code and was hoping to just plug that info into s sketch that would transmit it.

Then start with (File->Examples->IRremote->SimpleSender)

Thanks johnwasser. That looks like what I'm looking for. Can I send you one of my IRWidgets to show my gratitude? See here:
[Build a TV Commercial Killer - Circuit Cellar]
for how to contact me directly to provide shipping address if you're interested.

I can't find the ATmega328P platform (for Arduino NANO) listed in PinDefinitionsAndMore.h
What would the IR_SEND_PIN be for SimpleSender ?

The default send pin is still 3 for the mega328 boards.

But, apparently, it can be changed, if necessary, to pin 9. From the IRTimer.hpp file:

/***************************************
 * Plain AVR CPU's, no boards
 ***************************************/
// Arduino Duemilanove, Diecimila, LilyPad, Mini, Fio, Nano, etc
// ATmega328
#if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328PB__) || defined(__AVR_ATmega168__)
#  if !defined(IR_USE_AVR_TIMER1) && !defined(IR_USE_AVR_TIMER2)
//#define IR_USE_AVR_TIMER1   // send pin = pin 9
#define IR_USE_AVR_TIMER2     // send pin = pin 3
#  endif

I'm trying to use the SimpleSender sketch from the IRremote Examples to send an IR signal of any protocol, any code, so I can look at the output with a 'scope and see how accurately the job is done. The example sketch is beyond my level of understanding, so what I have done is delete 70 of the 89 lines of the example sketch, all of which were marked as comments. My abbreviated version won't even compile. It stops on the second instruction and says "PinDefinitions AndMore.h: No such file or directory" How am I mis-using the example sketch? Is it written for a certain Arduino board?

* SimpleSender.cpp  (This is an abbreviated version)
 *
 *  Demonstrates sending IR codes in standard format with address and command

 *  Copyright (C) 2020-2021  Armin Joachimsmeyer
 *  armin.joachimsmeyer@gmail.com
//
#include <Arduino.h>
#include "PinDefinitionsAndMore.h"
#include <IRremote.hpp>
void setup() {
    pinMode(LED_BUILTIN, OUTPUT);
uint16_t sAddress = 0x0102;
uint8_t sCommand = 0x34;
uint8_t sRepeats = 0;
void loop() {
    sAddress += 0x0101;
    sCommand += 0x11;
    sRepeats++;
    if (sRepeats > 4) {
        sRepeats = 4;
    }
    delay(1000);  // delay must be greater than 5 ms (RECORD_GAP_MICROS), otherwise the receiver sees it as one long signal
}type or paste code here

Your posted code has at least one other problem. There is a missing } to close the setup() function.
You should see a tab with the PinDefinitions AndMore.h file in it. If it is not there try reloading the example.

pin def tab

How do you know if you didn't delete something important?

I loaded the SimpleSender sketch onto my Uno with no changes and it compiled with no warnings or errors.

I wired an IR LED to pin 3 of the Uno with the SimpleSender sketch and another Uno with an IR decoder/detector. The second Uno had the SimpleReceiver sketch loaded, DECODE_NEC selected. The second Uno receives the codes that the first is sending.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.