SHARE
TWEET

Untitled

a guest Jun 9th, 2012 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // IR code deformer
  2. //              /SAJAT IR VEVO lent/
  3. // ___
  4. //|( )|  PIN 1 = GND
  5. //|___|  PIN 2 = 3V3
  6. //| | |  PIN 3 = SIGNAL TO ARDUINO PWM PIN 11
  7. //| | |
  8. //1 2 3
  9.  
  10. #include <IRremote.h>
  11.  
  12. int RECV_PIN = 11;
  13. IRsend irsend;
  14. IRrecv irrecv(RECV_PIN);
  15. decode_results results;
  16.  
  17. int ledPin = 3;         // LED pin
  18. int flashPin = 13;       // Switch pin
  19.  
  20. void setup()
  21. {                  
  22.   Serial.begin(9600);
  23.   pinMode(ledPin, OUTPUT);
  24.   pinMode(flashPin, OUTPUT);
  25.   Serial.println("Minden OK, johet a kod!");
  26.   irrecv.enableIRIn(); // Start the receiver
  27. }
  28.  
  29.  
  30.  
  31. void loop()                      
  32. {
  33.  
  34.   if (irrecv.decode(&results)) {
  35.         switch (results.value) {
  36.           case 0xFF6897:
  37.             Serial.print("0 - led be");
  38.             digitalWrite(flashPin, HIGH);
  39.             break;
  40.           case 0xFF30CF:
  41.             Serial.print("1 - led ki");
  42.             digitalWrite(flashPin, LOW);
  43.             break;
  44.           case 0xFF18E7:
  45.             Serial.print("2 - led be es POWER signal");
  46.             digitalWrite(flashPin, HIGH);
  47.             irsend.sendNEC(0x5EA1F807, 32);
  48.             break;          
  49.           case 0xFF7A85:
  50.             Serial.println("gomb 3");
  51.             break;          
  52.         }
  53.  
  54.     irrecv.resume(); // Receive the next value
  55.   }
  56.  
  57.  
  58. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top