#include <IRremote.h>
int ledstate=LOW;
int relaystate=HIGH;
int led=13;
int relay=3;
IRrecv irrecv(11);
decode_results results;
void setup(){
irrecv.enableIRIn(); //Boot infrared decoding
pinMode(led,OUTPUT);
pinMode(relay,OUTPUT);
digitalWrite(relay,relaystate);
digitalWrite(led,ledstate);
Serial.begin(9600);
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value,HEX);
if(results.value == 0xFD00FF){
ledstate =!ledstate;
relaystate=!relaystate;
Serial.print("resusts= ");
Serial.println(results.value,HEX);
Serial.print("ledstate is =");
Serial.println(ledstate);
Serial.print("relaystate is=");
Serial.println(relaystate);
digitalWrite(led,ledstate);
digitalWrite(relay,relaystate);
}
irrecv.resume();
}
Serial.println("Waiting for results........");
}[code]
What works or not works?
Wiring diagram helps.
.
So tell us what you see in the serial monitor?
Better yet copy and paste it into some code tags.
Here we go again... remember this thread?
At least he put code tags this time!