Advertisement
bladatwarz6

Untitled

Oct 25th, 2014
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <IRremote.h>
  2. #define irPin 11
  3. IRrecv irrecv(irPin);
  4. decode_results results;
  5.  
  6. #define bluePin 5
  7. #define greenPin 6
  8.  
  9. int jasnosc = 0;
  10.  
  11. void setup() {
  12. Serial.begin(57600);
  13. irrecv.enableIRIn();
  14.  
  15. pinMode(bluePin, OUTPUT);
  16. pinMode(greenPin, OUTPUT);
  17. }
  18.  
  19. void loop() {
  20. if (irrecv.decode(&results)) {
  21.  
  22. switch (results.value) {
  23. case 0x96:
  24. if(jasnosc < 255) {jasnosc = jasnosc+5;}
  25. Serial.println(jasnosc);
  26. analogWrite(greenPin, 255);
  27. break;
  28.  
  29. case 0x896:
  30. if(jasnosc > 0) {jasnosc = jasnosc-5;}
  31. Serial.println(jasnosc);
  32. analogWrite(bluePin, 255);
  33. break;
  34. }
  35. irrecv.resume();
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement