Hi, I am new to the forum so I hope I have this in the right topic. I got kit back in July and have been playing around learning how to code and everything. I am currently trying to learn how to Send IR Signals. I have already got the Hex and address to power my tv on through my IR Receiver. How do I figure out the correct bit, so I can now transmit?
What code is it?
I don't know any other way to send the code besides writing it out. But this is the code I am using. It passes verification but when I upload it and press the button i doesn't turn the tv on. Serial monitor reads the button was pressed and data was sent, just nothing happens. I have a note next to the 'irsend.sendNEC' line, I have tried 8, 16, 32, and 36 bit values, still nothing works. Id really appreciate the help.
I mean the IR code you identified for activating your tv. What did the IR receiving code tell you?
It tells me "The function decode(&results) ) is derecated and may not work as expected! Just use decode() without a parameter and IrReceiver.decodeIRData.." Then it decodes the signal as NEC and gives me the Hex value. If it means anything the hex value is 8 digits long and is alphanumeric. The first 4 digits are '1CE3' followed by 3 digits that vary for each button, and concluded with and 'F'.
The code I used to get that is the "Mission 18 Remote IR Decode LED Brightness Control" code, I have it modified to also display on an LCD.
Then sendNEC() with 32 bits (8 hex digits) should work, unless the receiver told you something different.
For testing 2 Arduinos were fine. Then you can receive and report what the other Arduino effectively sends.
Ok, I put that in as "irsend.sendNEC(1CE348B7, 32);"
and it won't verify. It says, "Unable to find numeric literal operator 'operator ""CE348B7'
When I put the Hex value in as 0xE348B7 it accepts it though.
I just tried this with the Hex valve set as '0xE348B7' and 32 bits, my second arduino didn't receive anything.
I also just tries '0x' as a prefix to the 8 digit hex valve, still nothing received.
Just for the record, could it be how it's wired? I know my button is wired right cause it does whats it's supposed to, serial monitor proves that. The Infrared Diode is hooked up as follows: Diode positive to my Digital Pin 3 and the Diode negative runs to the ground via a 4.7K resistor.
That's 0x1CE348B7 in C.
I tried that too.
I just noticed something after compiling I expanded the error box to check for warnings and I found this.
"Warning: 'void IRsend::sendNEC(uint32_t, uint8_t)' is deprecated: This old function sends MSB first! Please use sendNEC( aAddress, aCommand, a NumberOfRepeats). [-Wdeprecated-declarations]"
Could that be the issue?
I got it, I ran a different receiver decoding code and got a completely different set of information. I got the Address, Command, Hex, and repeat gaus number. I then plugged that into a slightly modified code and now the IR is turning on my tv.
Do I need to mark this thread or anything to show its solved or what?
Well, you can if you like.
Ok, @Paul_B how do I do that?
TBH, I don't know as I have (almost) never started a thread!
There will be an option below your chosen reply (interestingly, even a reply of your own).
Is it the little check box left of the like possibly... I'm going to click it.