Advertisement
STANAANDREY

ir2

Aug 13th, 2022 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include <FastLED.h>
  2. #include <IRremote.h>
  3.  
  4. //Strip Light Objects
  5. #define NUM_LEDS 240 // How many LEDs we're lighting
  6. CRGB leds[NUM_LEDS]; // Declare Strip Array
  7. #define PIN 6 // Pin that controls strip
  8. byte hue; // Use to hold colors
  9.  
  10. //IR Remote Objects
  11. int receiver = 3; // Pin that listens for IR
  12. IRrecv irrecv(receiver); // Declare IR Object
  13. decode_results results; // Holds IR Result Codes
  14.  
  15. /* IR Receive Codes
  16. 0xFFA25D: POWER
  17. 0xFFE21D: FUNC/STOP
  18. 0xFF629D: VOL+
  19. 0xFF22DD: FAST BACK"
  20. 0xFF02FD: PAUSE
  21. 0xFFC23D: FAST FORWARD
  22. 0xFFE01F: DOWN
  23. 0xFFA857: VOL-
  24. 0xFF906F: UP
  25. 0xFF9867: EQ
  26. 0xFFB04F: ST/REPT
  27. 0xFF6897: 0
  28. 0xFF30CF: 1
  29. 0xFF18E7: 2
  30. 0xFF7A85: 3
  31. 0xFF10EF: 4
  32. 0xFF38C7: 5
  33. 0xFF5AA5: 6
  34. 0xFF42BD: 7
  35. 0xFF4AB5: 8
  36. 0xFF52AD: 9
  37. 0xFFFFFFFF: Repeat
  38. */
  39.  
  40. void setup()
  41. {
  42. //Setup LED Strip
  43. FastLED.addLeds<NEOPIXEL, PIN>(leds, NUM_LEDS);
  44. FastLED.setBrightness(255);
  45. FastLED.clear();
  46.  
  47. //Setup IR Receiver
  48. irrecv.enableIRIn();
  49.  
  50. Serial.begin(115200);
  51. }
  52.  
  53. void loop() {
  54. if (irrecv.decode(&results)) {
  55. irrecv.resume();
  56. Serial.println(results.value);
  57. }
  58. delay(50);
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement