Hello fellow humans ( I've been stuck for 4 days on capturing and sending a raw infrared signal. I have close to none experience using this library, so any help would be great!
I'm using an esp32 with a library to use the Arduino IDE.
This is my setup, the only difference is that the input pin for the ir led is 17 and that I'm not using a resistance in my circuit.
Alright, let's dive in (:
My idea was to first 'catch' the signal using the ir receiver, this doesn't cause any problems, but just to be sure, this is the general signal that it receives:
I'll now discuss the code that I've written
#include <Arduino.h>
#include <assert.h>
#include <IRrecv.h>
#include <IRac.h>
#include <IRtext.h>
#include <IRutils.h>
#include <SPI.h>
#include <SD.h>
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRsend.h>
const char bracket = ']';
const char comma = ',';
File myFile;
const int CS = 5;
String lengthData;
String backupNumber;
int secondIrCounter = 0;
String rawData;
const uint16_t kIrLed = 17;
IRsend irsend(kIrLed);
IRrecv irrecv(27);
decode_results results;```
Here I put in all the needed libraries and some variables that I'll be needing in my code
void setup(){
Serial.begin(115200);
irrecv.enableIRIn();
irsend.begin();
}```
Here I enable the receiver and the sender of ir signals.
uint16_t noResult[lengthData.toInt()] = {};
for(int i = 15; i <= resultToTimingInfo(&results).length(); i++){
if(resultToTimingInfo(&results)[i] == comma){
noResult[secondIrCounter] = rawData.toInt();
rawData = "";
secondIrCounter = secondIrCounter +1;
}
if(isdigit(resultToTimingInfo(&results)[i])){
rawData = rawData +resultToTimingInfo(&results)[i];
}
}
rawData = "";
for(int i = (resultToTimingInfo(&results).length()-6); i <= resultToTimingInfo(&results).length(); i++){
if(isdigit(resultToTimingInfo(&results)[i])){
rawData = rawData +resultToTimingInfo(&results)[i];
}
}
noResult[lengthData.toInt()-1] = rawData.toInt();
for(int i = 0; i<=(lengthData.toInt()-1);i++){
Serial.println(noResult[i]);
}
delay(1000);
irrecv.resume();```
This part is a bit tricky, it gets the received ir sequence, which is a string, and puts it in an int.
for(int i = 0; i<(lengthData.toInt());i++){
Serial.println(noResult[i]);
}
delay(300);
Serial.println("a rawData capture from IRrecvDumpV2");
irsend.sendRaw(noResult, lengthData.toInt(), 38); // Send a raw data capture at 38kHz.
}
}```
This is the actual part where I sent the raw data, I've checked it multiple times, and it actually does transmit something, it flickers in some sequence, the problem is that all devices that I've tested it with have failed to respond to the sent sequence.
If any of you have any idea of what is happening, please tell me! It would really help me out.
Kind regards and have a nice day,
Bas Boersma