Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <IRremote.h>
- const int RECV_PIN = 4;
- const int redPin = 13;
- // Define IR Receiver and Results Objects
- IRrecv irrecv(RECV_PIN);//irrecv is the receiver object, you can use whatever name you want
- decode_results results;
- int buttonState = 0;
- int togglestate = 0;
- int incomingByte;
- int state = HIGH;
- int reading;
- int previous = LOW;
- void setup()
- {
- Serial.begin(9600);
- irrecv.enableIRIn(); // Start the receiver
- pinMode(redPin, OUTPUT);
- }
- void loop(){
- if (irrecv.decode(&results)) {// irrecv.decode(&results) :Returns true if a code was receive
- Serial.println(results.value, HEX);
- if(results.value==0xFF28D7){
- digialWrite(redPin, LOW);
- delay(500);
- digitalWrite(redPin, HIGH);
- }
- delay(300);// this delay is here to avoid the 0xFFFFFFF
- irrecv.resume (); // Receive the next value
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement