TurnOnArgoAC.ino 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright 2017, 2018 crankyoldgit
  2. * An IR LED circuit *MUST* be connected to the ESP8266 on a pin
  3. * as specified by kIrLed below.
  4. *
  5. * TL;DR: The IR LED needs to be driven by a transistor for a good result.
  6. *
  7. * Suggested circuit:
  8. * https://github.com/markszabo/IRremoteESP8266/wiki#ir-sending
  9. *
  10. * Common mistakes & tips:
  11. * * Don't just connect the IR LED directly to the pin, it won't
  12. * have enough current to drive the IR LED effectively.
  13. * * Make sure you have the IR LED polarity correct.
  14. * See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity
  15. * * Typical digital camera/phones can be used to see if the IR LED is flashed.
  16. * Replace the IR LED with a normal LED if you don't have a digital camera
  17. * when debugging.
  18. * * Avoid using the following pins unless you really know what you are doing:
  19. * * Pin 0/D3: Can interfere with the boot/program mode & support circuits.
  20. * * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere.
  21. * * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere.
  22. * * ESP-01 modules are tricky. We suggest you use a module with more GPIOs
  23. * for your first time. e.g. ESP-12 etc.
  24. */
  25. #ifndef UNIT_TEST
  26. #include <Arduino.h>
  27. #endif
  28. #include <IRremoteESP8266.h>
  29. #include <IRsend.h>
  30. #include <ir_Argo.h>
  31. const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
  32. IRArgoAC ac(kIrLed); // Set the GPIO to be used to sending the message.
  33. void setup() {
  34. ac.begin();
  35. Serial.begin(115200);
  36. }
  37. void loop() {
  38. Serial.println("Sending...");
  39. // Set up what we want to send. See ir_Argo.cpp for all the options.
  40. ac.setPower(true);
  41. ac.setFan(kArgoFan1);
  42. ac.setCoolMode(kArgoCoolAuto);
  43. ac.setTemp(25);
  44. #if SEND_ARGO
  45. // Now send the IR signal.
  46. ac.send();
  47. #else // SEND_ARGO
  48. Serial.println("Can't send because SEND_ARGO has been disabled.");
  49. #endif // SEND_ARGO
  50. delay(5000);
  51. }