Arduino-IRremote error: Use of decode(decode_results *aResults) is deprecated! Use decode() instead!

preview_player
Показать описание
Arduino Pro Mini 3.3v + Infrared Receiver TL1838 VS1838B Remote Sensor 38Khz, sensor remot infra merah
How to fix Arduino IRremote Error: Use of decode(decode_results *aResults) is deprecated! Use decode() instead!

sketch with "Use of decode(decode_results *aResults) is deprecated! Use decode() instead!" error warning:
int input_pin = 5;
IRrecv IRR (input_pin);
decode_results results;

void setup () {
IRR.enableIRIn ();
}

void loop () {
if (IRR.decode (&results)) {
IRR.resume ();
}
}

without warning:
int input_pin = 5;
IRrecv IRR (input_pin);

void setup () {
IRR.enableIRIn ();
}

void loop () {
if (IRR.decode ()) {
IRR.resume ();
}
}

how to fix 0 (zero) result:
reinstall/restore/revert IRremote library to version 2.8.0
Рекомендации по теме
Комментарии
Автор

Fantastic!!! only 2.8.0 library work correctly, and you fix very super! thank you fantastic video!!! Very help for me!

masterkit
Автор

Thank you. This saved me a lot of time
how to fix 0 (zero) result:
reinstall/restore/revert IRremote library to version 2.8.0

taher
Автор

The function decode(&results)) is deprecated and may not work as expected! Just use decode() - without any parameter.

trung
Автор

That's the solution, thank you !

aquilanera
Автор

thank you so much. i appreciated it cuz it worked

RedScythe
Автор

Hey, I am also getting the error of 0 in the result for any button I press inspite of adding 2.8.0 version of ir remote.
I am attaching the sketch below. Please help me figure out the error

#include <IRremote.h>

#include <IRremote.h>

#define IRPIN 7

IRrecv irrecv(IRPIN);
decode_results result;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
Serial.println("Enabled IRin");
}

void loop(){
if (irrecv.decode())
{

irrecv.resume();
}
}

yugmathakore
Автор

doesn't work for me. serial monitor show only 0 if i push a button

LordPainti
Автор

What should i do in switch() except results.value???
Please I need your help

nikodemkarcz
Автор

Hi, I'm trying to decode the keys of a remote control; I followed your video and solved this problem ... but I don't understand why in the serial monitor it gives me only zeros and not the code of each key. Could you help me? Thank you, I await your reply :-)

manueledeambrosi
Автор

Bro knp ya setiap tombol saya pencet angka selalu berubah..misalkan angka 1 saya pencet di serial monitor tidak selalu sama..

#include <AFMotor.h>
#include <IRremote.h>

IRrecv IR(A2);

#define UP 87
#define DOWN 32
#define LEFT 215
#define RIGHT 216
#define STOP 82

AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);

void setup()
{
Serial.begin(9600);
IR.enableIRIn();
}

void loop() {
if (IR.decode()) {

IR.resume();
}
delay (100);
if (IR.results.value == UP) {
forward();
} else if (IR.results.value == DOWN) {
back();
} else if (IR.results.value == LEFT) {
left();
} else if (IR.results.value == RIGHT) {
right();
} else if (IR.results.value == STOP) {
Stop();
}
}


void forward() {
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}

void back() {
motor1.setSpeed(255);
motor1.run(BACKWARD);
motor2.setSpeed(255);
motor2.run(BACKWARD);
motor3.setSpeed(255);
motor3.run(BACKWARD);
motor4.setSpeed(255);
motor4.run(BACKWARD);
}

void left() {
motor1.setSpeed(255);
motor1.run(BACKWARD);
motor2.setSpeed(255);
motor2.run(BACKWARD);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}

void right() {
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(255);
motor3.run(BACKWARD);
motor4.setSpeed(255);
motor4.run(BACKWARD);
}

void Stop() {
motor1.setSpeed(0);
motor1.run(RELEASE);
motor2.setSpeed(0);
motor2.run(RELEASE);
motor3.setSpeed(0);
motor3.run(RELEASE);
motor4.setSpeed(0);
motor4.run(RELEASE);
}

Tolong bantu saya bro..

doel_
Автор

Sir I typed the program as given in the description box. But I got an error saying that IRrecv does not name a type. Can you help me out

austindilip
Автор

the serial port just displays 0's whenever I click the remote instead of the hex value

ahgrigor
Автор

Hi,
I followed the steps you showed but for some reason, I always get 0 when I press any button on the remote. Kindly help.
this is the code that I used:

#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()){
// Print Code in HEX
Serial.println(results.value, HEX);
irrecv.resume();
}
}

ssyal
Автор

I have a problem when I press any bottons it gives me a zero I use ir 1838 with arduino mega

Alaa_GDM
Автор

Thank you. It finally worked after months.
Does anyone know why my serial prints the result twice.
I copy and pasted the code. At first it printed 5 times. I added a 500 delay at the end, now it prints twice.
Adding a larger delay doesn't reduce it to one time.

jimba
Автор

hello, thank you so much for your help i was struggling for days..but i do have another problem when i press for example on-off button i get two different results 4C and 84C and also in every different button i tried i am getting two different results something and something with the 8 as the first digit..I am always getting two results for every button and one of them is with the 8 as a first digit..any ideas?
thank you in advance

giannissotiropoulos
Автор

Thanks you, but, I only received five zeros, Do you have any idea about that?

victormgt
Автор

Для русских, работает только версия 2.8.0, остальные версии кривые и глючные до ужаса, и без фикса на видео ничего не заработает.

masterkit
Автор

Cant you put a txt file in description

ProxyDev
Автор

Something went wrong, please help me see~thank you~~!

#include <IRremote.h>

IRrecv irrecv(6);
decode_results results;



void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}


void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume();
}
delay(100);
}

homechien
join shbcf.ru