I get... The function decode(&results)) is deprecated and may not work as expected! Just use decode() without a parameter and IrReceiver.decodedIRData. .
I'm just starting with Arduino,
> [code]
> #include <IRremote.hpp>
>
> /*
> IR Receiver Demonstration 1
> IR-Rcv-Demo1.ino
> Demonstrates IR codes with IR Receiver
> Displays results on Serial Monitor
>
> DroneBot Workshop 2017
> http://dronebotworkshop.com
> */
>
> // Include IR Remote Library by Ken Shirriff
> #include <IRremote.h>
>
> // Define sensor pin
> const int RECV_PIN = 4;
>
> // Define IR Receiver and Results Objects
> IRrecv irrecv(RECV_PIN);
> decode_results results;
>
>
> void setup(){
> // Serial Monitor @ 9600 baud
> Serial.begin(9600);
> // Enable the IR Receiver
> irrecv.enableIRIn();
> }
>
> void loop(){
> if (irrecv.decode(&results)){
> // Print Code in HEX
> Serial.println(results.value, HEX);
> irrecv.resume();
> }
> }
>
> [/code]
That warning is telling you that you are using old code with the new version of the IRremote library. The IRremote GitHub page tells you how to modify older code to work with the new library.
Use the examples from the new library to learn how the new version works.
I will have to look at that.
But so many questions. i.e. .h / .hpp
As I am very new (week) to all of this I was hoping someone would take pity on me and rewrite the code correctly.
Converting the code looks daunting to me at the moment.
The context is.. I'm hoping to reprogram an old remote control to make a kind of "busy box", (grandson) as he seems fixated with remotes at the minute.
So this code was to extract the codes from the remote.
I always heard "people lose interest when things fail". I think that can be true.
Oh, and I am 73, so not as sharp as once was
groundFungus, Thank you for that code.
Unfortunately, it's not working correctly here.
When I press a button on the remote, I get…
4⸮R⸮e, or this for multiple presses on the same button...
⸮5⸮⸮q尥P⸮⸮R⸮eҚ⸮⸮u⸮R⸮⸮R⸮⸮C⸮
The only thing I could think of to do, was to change the baud rate to 9600.
This gave me a different output…
IR receive test
command = 0
address = 0
raw data = 0
command = 0
address = 0
raw data = 0
command = 0
address = 0
raw data = 0
I obviously don't know what to do next.
Please post photos of the remote and your wiring.
No wiring yet, I am just at this stage of attempting to extract the button codes from the remote.
(I have tried two totally different types of remote controls)
(and I will take you up on the offer of help regarding the box, a little further down the line)
Are The full construction details available anywhere?
This looks like at least version 3 of what I have got in mind.
The one I am hoping to make currently (V1) will just have grandson using the remote control to get reactions from the box. (No point in putting the steady hand item for example, in at this stage, he would just drag it around the room )
It looks to me like you have an IR emitter/sensor pair to use for object detection. Post some more photos of the IR sensor and we can be sure. That sensor will not work to receive and decode IR remote signals](IR Remote Signals | IR Sensor | Adafruit Learning System).
You will need to acquire an IR receiver.. The receiver will recognize only the signal modulated at a certain carrier frequency (38KHz - 40KHz popular) and strip the data from the carrier.
command = 0
address = 0
raw data = 1792785869
command = 0
address = 0
raw data = 3289110549
command = 0
address = 0
raw data = 1236334118
command = 0
address = 0
raw data = 1776008254
command = 0
address = 0
raw data = 1253111733
command = 0
address = 0
raw data = 3268227023
A couple of observations, different results and double output.