Advertisement
Guest User

Untitled

a guest
Nov 3rd, 2018
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.32 KB | None | 0 0
  1. /*
  2. * IRremote: IRsendRawDemo - demonstrates sending IR codes with sendRaw
  3. * An IR LED must be connected to Arduino PWM pin 3.
  4. * Version 0.1 July, 2009
  5. * Copyright 2009 Ken Shirriff
  6. * http://arcfn.com
  7. *
  8. * IRsendRawDemo - added by AnalysIR (via www.AnalysIR.com), 24 August 2015
  9. *
  10. * This example shows how to send a RAW signal using the IRremote library.
  11. * The example signal is actually a 32 bit NEC signal.
  12. * Remote Control button: LGTV Power On/Off.
  13. * Hex Value: 0x20DF10EF, 32 bits
  14. *
  15. * It is more efficient to use the sendNEC function to send NEC signals.
  16. * Use of sendRaw here, serves only as an example of using the function.
  17. *
  18. */
  19.  
  20.  
  21. #include <IRremote.h>
  22.  
  23. IRsend irsend;
  24.  
  25. void setup()
  26. {
  27.  
  28. }
  29.  
  30. void loop() {
  31. int khz = 38; // 38kHz carrier frequency for the NEC protocol
  32. unsigned int irSignal[] = {3400, -1728, 416, -1296, 432, -1280, 428, -432, 432, -428, 420, -448, 428, -1280, 432, -432, 344, -516, 428, -1280, 432, -1276, 348, -516, 420, -1296, 344, -516, 348, -516, 428, -1280, 344, -1372, 344, -516, 428, -1284, 432, -1276, 420, -448, 428, -432, 412, -1300, 428, -428, 432, -432, 464, -1260, 344, -520, 344, -520, 344, -516, 432, -428, 344, -516, 416, -448, 404, -460, 344, -520, 344, -520, 400, -460, 428, -432, 428, -432, 432, -428, 404, -456, 416, -448, 432, -424, 348, -520, 432, -428, 496, -372, 344, -516, 348, -1364, 432, -428, 432, -432, 456, -404, 412, -448, 420, -444, 404, -1308, 348, -1364, 348, -516, 428, -432, 428, -432, 432, -428, 432, -428, 432, -1280, 344, -1372, 428, -432, 344, -520, 428, -432, 384, -480, 344, -516, 344, -1372, 428, -1284, 428, -428, 436, -1276, 416, -1304, 348, -516, 416, -448, 428, -432, 432, -428, 428, -428, 432, -428, 432, -428, 348, -516, 428, -1280, 348, -516, 344, -520, 416, -444, 348, -516, 416, -1296, 348, -1368, 344, -1368, 432, -1280, 348, -516, 428, -432, 428, -428, 432, -428, 344, -516, 428, -432, 400, -460, 416, -448, 348, -520, 396, -464, 344, -520, 400, -460, 432, -428, 432, -428, 432, -428, 344, -516, 416, -448, 432, -432, 344, -516, 432, -432, 416, -448, 344, -516, 344, -516, 344, -516, 432, -428, 344, -516, 344, -520, 432, -432, 344, -520, 400, -460, 480, -1244, 432, -428, 432, -432, 428, -432, 432, -428, 428, -428, 432, -428, 348, -516, 344, -516, 348, -512, 344, -520, 432, -428, 428, -428, 432, -432, 344, -516, 348, -516, 432, -432, 432, -424, 432, -428, 404, -1312, 344, -1372, 416, -1296, 344, -516, 344, -520, 344, -1368, 344, -1368, 416, -448, 432, -16928, 3536, -1724, 432, -1280, 432, -1276, 348, -516, 420, -444, 416, -448, 344, -1368, 452, -416, 344, -520, 344, -1364, 348, -1368, 452, -416, 344, -1380, 432, -428, 344, -516, 416, -1304, 344, -1368, 432, -428, 432, -1280, 344, -1368, 432, -432, 428, -432, 344, -1368, 432, -428, 432, -428, 432, -1280, 344, -520, 428, -432, 344, -520, 428, -428, 344, -516, 416, -452, 344, -520, 344, -516, 348, -516, 344, -520, 428, -428, 432, -428, 432, -432, 344, -516, 364, -500, 428, -428, 344, -520, 432, -428, 496, -376, 344, -516, 344, -1368, 432, -428, 428, -432, 432, -432, 344, -516, 416, -448, 344, -1368, 344, -1368, 344, -516, 432, -432, 428, -432, 432, -428, 428, -432, 428, -1284, 400, -1312, 432, -428, 348, -516, 432, -432, 344, -516, 348, -512, 344, -1372, 432, -1280, 428, -432, 432, -1280, 364, -1348, 432, -432, 428, -432, 428, -432, 432, -428, 432, -424, 432, -428, 348, -516, 400, -464, 344, -1368, 428, -436, 424, -432, 452, -416, 452, -412, 400, -1316, 428, -1280, 432, -1280, 428, -1284, 344, -520, 344, -516, 344, -516, 428, -432, 348, -516, 428, -428, 400, -464, 364, -500, 344, -520, 344, -516, 348, -516, 400, -464, 428, -432, 424, -432, 432, -432, 400, -460, 364, -500, 428, -428, 344, -520, 432, -432, 468, -400, 344, -516, 344, -516, 428, -432, 432, -432, 428, -436, 344, -516, 428, -432, 428, -428, 416, -448, 428, -1284, 428, -432, 416, -448, 432, -432, 364, -496, 400, -464, 420, -448, 428, -432, 428, -432, 428, -432, 428, -428, 344, -520, 428, -428, 428, -432, 364, -500, 344, -516, 428, -432, 344, -520, 344, -524, 424, -1284, 428, -1280, 432, -1280, 396, -468, 344, -516, 472, -1260, 344, -1368, 416, -444, 368}; //AnalysIR Batch Export (IRremote) - RAW
  33.  
  34. irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array.
  35.  
  36. delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately.
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement