[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself


View post   

File: 426 KB, 551x405, 515b4656ce395f8a38000000.png [View same] [iqdb] [saucenao] [google]
1079103 No.1079103 [Reply] [Original]

Hey I've been working with this starter code for an IR receiver and I cant get it to work and I cant find anything to fix it

#include <IRremote.h>
int RECV_PIN=11;
IRrecv irrecv(RECV_PIN);
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);
}

>> No.1079122

>decode_results results;

>> No.1079128

Are you retarded or do you honestly don't know how to ask for help? How about both?

I have no idea what the fuck you're including in your namespace. At least provide some context (I could google IRremote.h and hope to find something but fuck you, pay me).

>> No.1079142

What happens? Errors? What errors? How is it hooked up? What are you trying to do?

>> No.1079462

#include <IRremote.h>

const unsigned int IR_RECEIVER_PIN = 2;

IRrecv ir_receiver(IR_RECEIVER_PIN);

decode_results results;

void setup() {

Serial.begin(9600);
ir_receiver.enableIRIn();

}//end setup

void loop() {

if (ir_receiver.decode(&results)) {

//code goes here

}//end if

}//end loop

This is what I have and it works fine.