-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
135 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* Copyright 2017, 2018 David Conran | ||
* | ||
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin | ||
* as specified by kIrLed below. | ||
* | ||
* TL;DR: The IR LED needs to be driven by a transistor for a good result. | ||
* | ||
* Suggested circuit: | ||
* https://github.com/crankyoldgit/IRremoteESP8266/wiki#ir-sending | ||
* | ||
* Common mistakes & tips: | ||
* * Don't just connect the IR LED directly to the pin, it won't | ||
* have enough current to drive the IR LED effectively. | ||
* * Make sure you have the IR LED polarity correct. | ||
* See: https://learn.sparkfun.com/tutorials/polarity/diode-and-led-polarity | ||
* * Typical digital camera/phones can be used to see if the IR LED is flashed. | ||
* Replace the IR LED with a normal LED if you don't have a digital camera | ||
* when debugging. | ||
* * Avoid using the following pins unless you really know what you are doing: | ||
* * Pin 0/D3: Can interfere with the boot/program mode & support circuits. | ||
* * Pin 1/TX/TXD0: Any serial transmissions from the ESP8266 will interfere. | ||
* * Pin 3/RX/RXD0: Any serial transmissions to the ESP8266 will interfere. | ||
* * ESP-01 modules are tricky. We suggest you use a module with more GPIOs | ||
* for your first time. e.g. ESP-12 etc. | ||
*/ | ||
#include <Arduino.h> | ||
#include <IRremoteESP8266.h> | ||
#include <IRsend.h> | ||
#include <ir_Midea.h> | ||
|
||
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2). | ||
IRMideaAC ac(kIrLed); // Set the GPIO used for sending messages. | ||
|
||
void printState() { | ||
// Display the settings. | ||
Serial.println("Mitsubishi A/C remote is in the following state:"); | ||
Serial.printf(" %s\n", ac.toString().c_str()); | ||
// Display the encoded IR sequence. | ||
unsigned char* ir_code = ac.getRaw(); | ||
Serial.print("IR Code: 0x"); | ||
for (uint8_t i = 0; i < kMitsubishiACStateLength; i++) | ||
Serial.printf("%02X", ir_code[i]); | ||
Serial.println(); | ||
} | ||
|
||
void setup() { | ||
ac.begin(); | ||
Serial.begin(115200); | ||
delay(200); | ||
|
||
Serial.println("Default state of the remote."); | ||
printState(); | ||
Serial.println("Setting desired state for A/C."); | ||
ac.on(); | ||
ac.setMode(kMideaACFan); | ||
ac.setBeep(false); | ||
} | ||
|
||
void loop() { | ||
// Now send the IR signal. | ||
#if SEND_MITSUBISHI_AC | ||
Serial.println("Sending IR command to A/C ..."); | ||
ac.send(); | ||
#endif // SEND_MITSUBISHI_AC | ||
printState(); | ||
delay(5000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[platformio] | ||
src_dir = . | ||
|
||
[env] | ||
lib_extra_dirs = ../../ | ||
lib_ldf_mode = deep+ | ||
lib_ignore = examples | ||
framework = arduino | ||
monitor_speed = 115200 | ||
build_flags = ; -D_IR_LOCALE_=en-AU | ||
|
||
[env:nodemcuv2] | ||
platform = espressif8266 | ||
board = nodemcuv2 | ||
|
||
[env:esp32dev] | ||
platform = espressif32 | ||
board = esp32dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters