I am trying to use my Arduino as a remote by making use of the IRremote library. I installed the library. But when i try the IRSend demo, it shows 'class IRsend' has no member named 'sendSony'. I saw on the web that this is due to a conflict with the RobotIRremote library already in Arduino. So i removed that library and tried installing the IRremote again, but it shows the same error. Any ideas on how to solve this?
You forgot the #define SONY:
From the github page:
Usage
We get a lot of support for different device types. To keep the size of the library manageable we're moving to a model where different device types use a #define statement, for instance:
#define SHARP
You'd put this at the top of your sketch to include the sendSharp() and decodeSharp() methods in your code. This way your sketch only uses the Sharp functions but not the LG, JVC, Sony, etc functions, thus saving you program space that you might want to use for other things. This allows us to support lots of devices without making the library too big.
Yesterday I tried to record IR signal from my AC remote. There was no information about my model. I am using Airwell RC-4. So now I would like to share information which helped me to find the solution.
To record signal I used AnalysIR sketch for ac remotes which was posted on this forum. To send signal I used Ken Shiriff IRlib. Remote operating frequency is 33 kHz.
/*
Author: AnalysIR
Revision: 1.0
This code is provided to overcome an issue with Arduino IR libraries
It allows you to capture raw timings for signals longer than 255 marks & spaces.
Typical use case is for long Air conditioner signals.
You can use the output to plug back into IRremote, to resend the signal.
This Software was written by AnalysIR.
Usage: Free to use, subject to conditions posted on blog below.
Please credit AnalysIR and provide a link to our website/blog, where possible.
Copyright AnalysIR 2014
Please refer to the blog posting for conditions associated with use.
http://www.analysir.com/blog/2014/03/19/air-conditioners-problems-recording-long-infrared-remote-control-signals-arduino/
Connections:
IR Receiver Arduino
V+ -> +5v
GND -> GND
Signal Out -> Digital Pin 2
(If using a 3V Arduino, you may connect V+ to +3V)
*/
#define LEDPIN 13
//you may increase this value on Arduinos with greater than 2k SRAM
#define maxLen 800
volatile unsigned int irBuffer[maxLen]; //stores timings - volatile because changed by ISR
volatile unsigned int x = 0; //Pointer thru irBuffer - volatile because changed by ISR
void setup() {
Serial.begin(9500); //change BAUD rate as required
attachInterrupt(0, rxIR_Interrupt_Handler, CHANGE);//set up ISR for receiving IR signal
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(F("Press the button on the remote now - once only"));
delay(5000); // pause 5 secs
if (x) { //if a signal is captured
digitalWrite(LEDPIN, HIGH);//visual indicator that signal received
Serial.println();
Serial.print(F("Raw: (")); //dump raw header format - for library
Serial.print((x - 1));
Serial.print(F(") "));
detachInterrupt(0);//stop interrupts & capture until finshed here
for (int i = 1; i < x; i++) { //now dump the times
if (!(i & 0x1)) Serial.print(F("-"));
Serial.print(irBuffer[i] - irBuffer[i - 1]);
Serial.print(F(", "));
}
x = 0;
Serial.println();
Serial.println();
digitalWrite(LEDPIN, LOW);//end of visual indicator, for this time
attachInterrupt(0, rxIR_Interrupt_Handler, CHANGE);//re-enable ISR for receiving IR signal
}
}
void rxIR_Interrupt_Handler() {
if (x > maxLen) return; //ignore if irBuffer is already full
irBuffer[x++] = micros(); //just continually record the time-stamp of signal transitions
}
I used this code to send recorded signal
#include <IRremote.h>
IRsend irsend;
unsigned int power[181] = {3000,3764,1900,1088,836,1936,900,960,952,996,
1840,1088,836,1844,1904,1084,832,1088,836,1844,992,992,1844,1080,836,992,
840,1052,864,1056,868,1048,864,996,840,1080,844,1076,836,1084,844,984,836,
1088,840,1076,836,1056,868,988,840,1052,868,1084,832,1088,836,1844,1904,
1084,2936,3768,1904,1080,836,1940,896,964,960,988,1840,1088,836,1844,1904,
1084,840,1080,832,1848,988,964,1872,1084,840,988,836,1084,840,1080,836,1084,
840,988,836,1056,868,1080,836,1056,868,988,836,1024,900,1080,844,1048,864,
992,844,1076,836,1084,840,1080,836,1848,1900,1088,2932,3772,1900,1084,840,
1936,900,988,928,992,1844,1080,844,1840,1908,1080,836,1084,840,1840,996,
988,1868,1056,868,960,864,1056,868,1052,872,1048,868,960,872,1048,864,
1056,872,1048,864,964,872,1048,864,1056,868,1052,864,964,868,1052,864,
1056,868,1052,872,1812,1936,1048,3884};
void setup()
{
}
void loop() {
irsend.sendRaw(power,181,33);
delay(1000);
}