您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

38 行
1.5KB

  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. #include <IRremote.h>
  20. IRsend irsend;
  21. void setup()
  22. {
  23. }
  24. void loop() {
  25. int khz = 38; // 38kHz carrier frequency for the NEC protocol
  26. unsigned int irSignal[] = {9000, 4500, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 560, 560, 560, 560, 560, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 560, 560, 1690, 560, 1690, 560, 1690, 560, 1690, 560, 39416, 9000, 2210, 560}; //AnalysIR Batch Export (IRremote) - RAW
  27. irsend.sendRaw(irSignal, sizeof(irSignal) / sizeof(irSignal[0]), khz); //Note the approach used to automatically calculate the size of the array.
  28. delay(5000); //In this example, the signal will be repeated every 5 seconds, approximately.
  29. }