SHARE
TWEET

Untitled

a guest Jul 24th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* IRremoteESP8266: IRsendDemo - demonstrates sending IR codes with IRsend.
  2.  
  3.    Version 1.1 January, 2019
  4.    Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
  5.    Copyright 2009 Ken Shirriff, http://arcfn.com
  6.  
  7.    An IR LED circuit *MUST* be connected to the ESP8266 on a pin
  8.    as specified by kIrLed below.
  9.  
  10.    TL;DR: The IR LED needs to be driven by a transistor for a good result.
  11.  
  12.    Suggested circuit:
  13.        https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
  14.  
  15.    Common mistakes & tips:
  16.  *   * Don't just connect the IR LED directly to the pin, it won't
  17.        have enough current to drive the IR LED effectively.
  18.  *   * Make sure you have the IR LED polarity correct.
  19.        See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
  20.  *   * Typical digital camera/phones can be used to see if the IR LED is flashed.
  21.        Replace the IR LED with a normal LED if you don't have a digital camera
  22.        when debugging.
  23.  *   * Avoid using the following pins unless you really know what you are doing:
  24.  *     * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
  25.  *     * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
  26.  *     * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
  27.  *   * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
  28.        for your first time. e.g. ESP-12 etc.
  29. */
  30.  
  31. #include <Arduino.h>
  32. #include <IRremoteESP8266.h>
  33. #include <IRsend.h>
  34.  
  35. const long kIrLed = 13;  // ESP8266 GPIO pin to use. Recommended: 4 (D2).
  36.  
  37. IRsend irsend(kIrLed);  // Set the GPIO to be used to sending the message.
  38.  
  39. // Example of data captured by IRrecvDumpV2.ino
  40. uint16_t  power[41] = {2600, 950, 400, 900, 400, 450, 400, 500, 400, 900, 850, 450, 400, 500, 400, 450, 400, 500, 400, 450, 450, 450, 400, 450, 400, 500, 350, 500, 400, 500, 400, 450, 400, 450, 850, 500, 400, 900, 400, 450, 400}; // UNKNOWN 9EFD9986
  41.  
  42.  
  43. void setup() {
  44.   irsend.begin();
  45. #if ESP8266
  46.   Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
  47. #else  // ESP8266
  48.   Serial.begin(115200, SERIAL_8N1);
  49. #endif  // ESP8266
  50. }
  51.  
  52. void loop() {
  53.  
  54.   Serial.println("a rawData capture from IRrecvDumpV2");
  55.   irsend.sendRaw(power, sizeof(power) / sizeof(power[0]), 38); //Note the approach used to automatically calculate the size of the array.
  56.   delay(3000);
  57. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top