// Serial Monitor TSOP 1738 for IR Remote
#include <IRremote.h>
// Define sensor pin
int RECV_PIN = 5;
// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600); // Serial Monitor @9600 baud
Serial.println("Enabling IRin");
irrecv.enableIRIn(); // Start the receiver
Serial.println("Enabling IRin");
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX); //Print HEX code
irrecv.resume(); // Receive the next value
}
}
// End of the code
It shows some error message while executing. The error messages are as follows:
C:\Users\USER\TSOP1738_Serial_Monitor\TSOP1738_Serial_Monitor.ino: In function 'void loop()':
C:\Users\USER\TSOP1738_Serial_Monitor\TSOP1738_Serial_Monitor.ino:22:29: warning: 'bool IRrecv::decode(decode_results*)' is deprecated: Please use IrReceiver.decode() without a parameter and IrReceiver.decodedIRData. . [-Wdeprecated-declarations]
if (irrecv.decode(&results))
^
In file included from C:\Users\USER\OneDrive\Documents\Arduino\libraries\IRremote-3.3.0\src/IRremote.h:188:0,
from C:\Users\USER\TSOP1738_Serial_Monitor\TSOP1738_Serial_Monitor.ino:3:
C:\Users\USER\OneDrive\Documents\Arduino\libraries\IRremote-3.3.0\src/IRReceive.cpp.h:1373:6: note: declared here
bool IRrecv::decode(decode_results *aResults) {
^~~~~~
Sketch uses 5360 bytes (16%) of program storage space. Maximum is 32256 bytes.
Global variables use 647 bytes (31%) of dynamic memory, leaving 1401 bytes for local variables. Maximum is 2048 bytes.
I cannot understand why this code appears . I install IRremote library .