Ir esp8266 lib update and code impacts (#235)

* integrate new IRremoteESP8266 lib 2.4.2 and add new protocols

IR_RC6
IR_MITSUBISHI
IR_GICABLE
IR_MITSUBISHI2
IR_LASERTAG
IR_CARRIER_AC
IR_MIDEA
IR_NIKAI
IR_SHERWOOD
IR_DENON
IR_AIWA_RC_T501
IR_JVC
This commit is contained in:
Florian authored and GitHub committed 2018-07-22 16:44:10 +02:00
1 parent 9b258723a8
commit b12ee19979
130 files changed
+16548 -1693

No files matched your search

@@ -11,7 +11,8 @@
* Based on Ken Shirriff's IrsendDemo
* Version 0.1 July, 2009
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -49,7 +50,10 @@ uint16_t Samsung_power_toggle[71] = {
20, 20, 20, 63, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 63, 20,
20, 20, 63, 20, 63, 20, 63, 20, 63, 20, 63, 20, 63, 20, 1798};
IRsend irsend(4); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
void setup() {
irsend.begin();
@@ -58,6 +62,10 @@ void setup() {
void loop() {
Serial.println("Toggling power");
#if SEND_GLOBALCACHE
irsend.sendGC(Samsung_power_toggle, 71);
#else // SEND_GLOBALCACHE
Serial.println("Can't send because SEND_GLOBALCACHE has been disabled.");
#endif // SEND_GLOBALCACHE
delay(10000);
}
@@ -53,7 +53,9 @@ WiFiServer server(4998); // Uses port 4998.
WiFiClient client;
uint16_t *code_array;
IRsend irsend(4); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
void sendGCString(String str) {
int16_t index;
@@ -89,7 +91,9 @@ void sendGCString(String str) {
count++;
} while (index != -1);
#if SEND_GLOBALCACHE
irsend.sendGC(code_array, count); // All done. Send it.
#endif // SEND_GLOBALCACHE
free(code_array); // Free up the memory allocated.
}
@@ -99,7 +103,7 @@ void setup() {
delay(100);
Serial.println(" ");
Serial.println("IR TCP Server");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(900);
Serial.print(".");
@@ -107,7 +111,7 @@ void setup() {
server.begin();
IPAddress myAddress = WiFi.localIP();
Serial.println(myAddress);
Serial.println(myAddress.toString());
irsend.begin();
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,28 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags = -DMQTT_MAX_PACKET_SIZE=512
lib_deps_builtin =
lib_deps_external =
PubSubClient
WifiManager@0.12
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
[env:d1_mini]
platform=espressif8266
framework=arduino
board=d1_mini
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -3,7 +3,8 @@
* Version 0.2 June, 2017
* Copyright 2015 Mark Szabo
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -41,7 +42,9 @@ MDNSResponder mdns;
ESP8266WebServer server(80);
IRsend irsend(4); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
void handleRoot() {
server.send(200, "text/html",
@@ -61,7 +64,9 @@ void handleIr() {
for (uint8_t i = 0; i < server.args(); i++) {
if (server.argName(i) == "code") {
uint32_t code = strtoul(server.arg(i).c_str(), NULL, 10);
#if SEND_NEC
irsend.sendNEC(code, 32);
#endif // SEND_NEC
}
}
handleRoot();
@@ -97,7 +102,7 @@ void setup(void) {
Serial.print("Connected to ");
Serial.println(ssid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.println(WiFi.localIP().toString());
if (mdns.begin("esp8266", WiFi.localIP())) {
Serial.println("MDNS responder started");
@@ -1,5 +1,8 @@
/*
* IRremoteESP8266: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* This is very simple teaching code to show you how to use the library.
* If you are trying to decode your Infra-Red remote(s) for later replay,
* use the IRrecvDumpV2.ino example code instead of this.
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Example circuit diagram:
@@ -31,6 +34,11 @@ decode_results results;
void setup() {
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
while (!Serial) // Wait for the serial connection to be establised.
delay(50);
Serial.println();
Serial.print("IRrecvDemo is now running and waiting for IR message on Pin ");
Serial.println(RECV_PIN);
}
void loop() {
@@ -1,9 +1,22 @@
/*
* IRremoteESP8266: IRrecvDump - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 Sept, 2015
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
* Copyright 2009 Ken Shirriff, http://arcfn.com
*
***** DEPRECATED - DO NOT USE *****
* Unless you know what you are doing, you should be using the
* IRrecvDumpV2.ino sketch/example instead for capturing & decoding IR messages.
* In almost ALL ways it is BETTER, FASTER, and MORE DETAILED.
*
* This code is left only for legacy reasons, and as another simple example of
* how to use the IRremoteESP8266 library.
*
* As of November 2017 it will no longer be updated or supported.
* You have been warned.
***** DEPRECATED - DO NOT USE *****
*
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.2 Oct 2017
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
* JVC and Panasonic protocol added by Kristian Lauszus
* (Thanks to zenwheel and other people at the original blog post)
* LG added by Darryl Smith (based on the JVC protocol)
@@ -58,6 +71,8 @@ void dump(decode_results *results) {
Serial.print("Decoded AIWA RC T501: ");
} else if (results->decode_type == WHYNTER) {
Serial.print("Decoded Whynter: ");
} else if (results->decode_type == NIKAI) {
Serial.print("Decoded Nikai: ");
}
serialPrintUint64(results->value, 16);
Serial.print(" (");
@@ -65,7 +80,7 @@ void dump(decode_results *results) {
Serial.println(" bits)");
Serial.print("Raw (");
Serial.print(count, DEC);
Serial.print("): ");
Serial.print("): {");
for (uint16_t i = 1; i < count; i++) {
if (i % 100 == 0)
@@ -73,18 +88,17 @@ void dump(decode_results *results) {
if (i & 1) {
Serial.print(results->rawbuf[i] * RAWTICK, DEC);
} else {
Serial.write('-');
Serial.print(", ");
Serial.print((uint32_t) results->rawbuf[i] * RAWTICK, DEC);
}
Serial.print(" ");
}
Serial.println();
Serial.println("};");
}
void loop() {
if (irrecv.decode(&results)) {
serialPrintUint64(results.value, 16);
dump(&results);
Serial.println("DEPRECATED: Please use IRrecvDumpV2.ino instead!");
irrecv.resume(); // Receive the next value
}
}
@@ -1,13 +1,20 @@
/*
* IRremoteESP8266: IRrecvDumpV2 - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
*
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Copyright 2017 David Conran
*
* Example circuit diagram:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-receiving
*
* Changes:
* Version 0.3 November, 2017
* - Support for A/C decoding for some protcols.
* Version 0.2 April, 2017
* - Decode from a copy of the data so we can start capturing faster thus
* reduce the likelihood of miscaptures.
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
*/
#ifndef UNIT_TEST
@@ -16,183 +23,190 @@
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#if DECODE_AC
#include <ir_Daikin.h>
#include <ir_Fujitsu.h>
#include <ir_Gree.h>
#include <ir_Haier.h>
#include <ir_Kelvinator.h>
#include <ir_Midea.h>
#include <ir_Toshiba.h>
#endif // DECODE_AC
// ==================== start of TUNEABLE PARAMETERS ====================
// An IR detector/demodulator is connected to GPIO pin 14
// e.g. D5 on a NodeMCU board.
#define RECV_PIN 14
// The Serial connection baud rate.
// i.e. Status message will be sent to the PC at this baud rate.
// Try to avoid slow speeds like 9600, as you will miss messages and
// cause other problems. 115200 (or faster) is recommended.
// NOTE: Make sure you set your Serial Monitor to the same speed.
#define BAUD_RATE 115200
// An IR detector/demodulator is connected to GPIO pin 14(D5 on a NodeMCU
// board).
uint16_t RECV_PIN = 14;
// As this program is a special purpose capture/decoder, let us use a larger
// than normal buffer so we can handle Air Conditioner remote codes.
uint16_t CAPTURE_BUFFER_SIZE = 1024;
#define CAPTURE_BUFFER_SIZE 1024
// Nr. of milli-Seconds of no-more-data before we consider a message ended.
// TIMEOUT is the Nr. of milli-Seconds of no-more-data before we consider a
// message ended.
// This parameter is an interesting trade-off. The longer the timeout, the more
// complex a message it can capture. e.g. Some device protocols will send
// multiple message packets in quick succession, like Air Conditioner remotes.
// Air Coniditioner protocols often have a considerable gap (20-40+ms) between
// packets.
// The downside of a large timeout value is a lot of less complex protocols
// send multiple messages when the remote's button is held down. The gap between
// them is often also around 20+ms. This can result in the raw data be 2-3+
// times larger than needed as it has captured 2-3+ messages in a single
// capture. Setting a low timeout value can resolve this.
// So, choosing the best TIMEOUT value for your use particular case is
// quite nuanced. Good luck and happy hunting.
// NOTE: Don't exceed MAX_TIMEOUT_MS. Typically 130ms.
#define TIMEOUT 15U // Suits most messages, while not swallowing repeats.
#if DECODE_AC
#define TIMEOUT 50U // Some A/C units have gaps in their protocols of ~40ms.
// e.g. Kelvinator
// A value this large may swallow repeats of some protocols
#else // DECODE_AC
#define TIMEOUT 15U // Suits most messages, while not swallowing many repeats.
#endif // DECODE_AC
// Alternatives:
// #define TIMEOUT 90U // Suits messages with big gaps like XMP-1 & some aircon
// units, but can accidently swallow repeated messages
// units, but can accidentally swallow repeated messages
// in the rawData[] output.
// #define TIMEOUT MAX_TIMEOUT_MS // This will set it to our currently allowed
// maximum. Values this high are problematic
// because it is roughly the typical boundary
// where most messages repeat.
// e.g. It will stop decoding a message and
// start sending it to serial at precisely
// the time when the next message is likely
// to be transmitted, and may miss it.
// Set the smallest sized "UNKNOWN" message packets we actually care about.
// This value helps reduce the false-positive detection rate of IR background
// noise as real messages. The chances of background IR noise getting detected
// as a message increases with the length of the TIMEOUT value. (See above)
// The downside of setting this message too large is you can miss some valid
// short messages for protocols that this library doesn't yet decode.
//
// Set higher if you get lots of random short UNKNOWN messages when nothing
// should be sending a message.
// Set lower if you are sure your setup is working, but it doesn't see messages
// from your device. (e.g. Other IR remotes work.)
// NOTE: Set this value very high to effectively turn off UNKNOWN detection.
#define MIN_UNKNOWN_SIZE 12
// ==================== end of TUNEABLE PARAMETERS ====================
// Use turn on the save buffer feature for more complete capture coverage.
IRrecv irrecv(RECV_PIN, CAPTURE_BUFFER_SIZE, TIMEOUT, true);
decode_results results; // Somewhere to store the results
// Display the human readable state of an A/C message if we can.
void dumpACInfo(decode_results *results) {
String description = "";
#if DECODE_DAIKIN
if (results->decode_type == DAIKIN) {
IRDaikinESP ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_DAIKIN
#if DECODE_FUJITSU_AC
if (results->decode_type == FUJITSU_AC) {
IRFujitsuAC ac(0);
ac.setRaw(results->state, results->bits / 8);
description = ac.toString();
}
#endif // DECODE_FUJITSU_AC
#if DECODE_KELVINATOR
if (results->decode_type == KELVINATOR) {
IRKelvinatorAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_KELVINATOR
#if DECODE_TOSHIBA_AC
if (results->decode_type == TOSHIBA_AC) {
IRToshibaAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_TOSHIBA_AC
#if DECODE_GREE
if (results->decode_type == GREE) {
IRGreeAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_GREE
#if DECODE_MIDEA
if (results->decode_type == MIDEA) {
IRMideaAC ac(0);
ac.setRaw(results->value); // Midea uses value instead of state.
description = ac.toString();
}
#endif // DECODE_MIDEA
#if DECODE_HAIER_AC
if (results->decode_type == HAIER_AC) {
IRHaierAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_HAIER_AC
// If we got a human-readable description of the message, display it.
if (description != "") Serial.println("Mesg Desc.: " + description);
}
// The section of code run only once at start-up.
void setup() {
// Status message will be sent to the PC at 115200 baud
Serial.begin(115200, SERIAL_8N1, SERIAL_TX_ONLY);
delay(500); // Wait a bit for the serial connection to be establised.
Serial.begin(BAUD_RATE, SERIAL_8N1, SERIAL_TX_ONLY);
while (!Serial) // Wait for the serial connection to be establised.
delay(50);
Serial.println();
Serial.print("IRrecvDumpV2 is now running and waiting for IR input on Pin ");
Serial.println(RECV_PIN);
#if DECODE_HASH
// Ignore messages with less than minimum on or off pulses.
irrecv.setUnknownThreshold(MIN_UNKNOWN_SIZE);
#endif // DECODE_HASH
irrecv.enableIRIn(); // Start the receiver
}
// Display encoding type
//
void encoding(decode_results *results) {
switch (results->decode_type) {
default:
case UNKNOWN: Serial.print("UNKNOWN"); break;
case NEC: Serial.print("NEC"); break;
case NEC_LIKE: Serial.print("NEC (non-strict)"); break;
case SONY: Serial.print("SONY"); break;
case RC5: Serial.print("RC5"); break;
case RC5X: Serial.print("RC5X"); break;
case RC6: Serial.print("RC6"); break;
case RCMM: Serial.print("RCMM"); break;
case DISH: Serial.print("DISH"); break;
case SHARP: Serial.print("SHARP"); break;
case JVC: Serial.print("JVC"); break;
case SANYO: Serial.print("SANYO"); break;
case SANYO_LC7461: Serial.print("SANYO_LC7461"); break;
case MITSUBISHI: Serial.print("MITSUBISHI"); break;
case SAMSUNG: Serial.print("SAMSUNG"); break;
case LG: Serial.print("LG"); break;
case WHYNTER: Serial.print("WHYNTER"); break;
case AIWA_RC_T501: Serial.print("AIWA_RC_T501"); break;
case PANASONIC: Serial.print("PANASONIC"); break;
case DENON: Serial.print("DENON"); break;
case COOLIX: Serial.print("COOLIX"); break;
}
if (results->repeat) Serial.print(" (Repeat)");
}
// Dump out the decode_results structure.
//
void dumpInfo(decode_results *results) {
if (results->overflow)
Serial.printf("WARNING: IR code too big for buffer (>= %d). "
"These results shouldn't be trusted until this is resolved. "
"Edit & increase CAPTURE_BUFFER_SIZE.\n",
CAPTURE_BUFFER_SIZE);
// Show Encoding standard
Serial.print("Encoding : ");
encoding(results);
Serial.println("");
// Show Code & length
Serial.print("Code : ");
serialPrintUint64(results->value, 16);
Serial.print(" (");
Serial.print(results->bits, DEC);
Serial.println(" bits)");
}
uint16_t getCookedLength(decode_results *results) {
uint16_t length = results->rawlen - 1;
for (uint16_t i = 0; i < results->rawlen - 1; i++) {
uint32_t usecs = results->rawbuf[i] * RAWTICK;
// Add two extra entries for multiple larger than UINT16_MAX it is.
length += (usecs / UINT16_MAX) * 2;
}
return length;
}
// Dump out the decode_results structure.
//
void dumpRaw(decode_results *results) {
// Print Raw data
Serial.print("Timing[");
Serial.print(results->rawlen - 1, DEC);
Serial.println("]: ");
for (uint16_t i = 1; i < results->rawlen; i++) {
if (i % 100 == 0)
yield(); // Preemptive yield every 100th entry to feed the WDT.
if (i % 2 == 0) { // even
Serial.print("-");
} else { // odd
Serial.print(" +");
}
Serial.printf("%6d", results->rawbuf[i] * RAWTICK);
if (i < results->rawlen - 1)
Serial.print(", "); // ',' not needed for last one
if (!(i % 8)) Serial.println("");
}
Serial.println(""); // Newline
}
// Dump out the decode_results structure.
//
void dumpCode(decode_results *results) {
// Start declaration
Serial.print("uint16_t "); // variable type
Serial.print("rawData["); // array name
Serial.print(getCookedLength(results), DEC); // array size
Serial.print("] = {"); // Start declaration
// Dump data
for (uint16_t i = 1; i < results->rawlen; i++) {
uint32_t usecs;
for (usecs = results->rawbuf[i] * RAWTICK;
usecs > UINT16_MAX;
usecs -= UINT16_MAX)
Serial.printf("%d, 0", UINT16_MAX);
Serial.print(usecs, DEC);
if (i < results->rawlen - 1)
Serial.print(", "); // ',' not needed on last one
if (i % 2 == 0) Serial.print(" "); // Extra if it was even.
}
// End declaration
Serial.print("};"); //
// Comment
Serial.print(" // ");
encoding(results);
Serial.print(" ");
serialPrintUint64(results->value, HEX);
// Newline
Serial.println("");
// Now dump "known" codes
if (results->decode_type != UNKNOWN) {
// Some protocols have an address &/or command.
// NOTE: It will ignore the atypical case when a message has been decoded
// but the address & the command are both 0.
if (results->address > 0 || results->command > 0) {
Serial.print("uint32_t address = 0x");
Serial.print(results->address, HEX);
Serial.println(";");
Serial.print("uint32_t command = 0x");
Serial.print(results->command, HEX);
Serial.println(";");
}
// All protocols have data
Serial.print("uint64_t data = 0x");
serialPrintUint64(results->value, 16);
Serial.println(";");
}
}
// The repeating section of the code
//
void loop() {
// Check if the IR code has been received.
if (irrecv.decode(&results)) {
dumpInfo(&results); // Output the results
dumpRaw(&results); // Output the results in RAW format
dumpCode(&results); // Output the results as source code
Serial.println(""); // Blank line between entries
// Display a crude timestamp.
uint32_t now = millis();
Serial.printf("Timestamp : %06u.%03u\n", now / 1000, now % 1000);
if (results.overflow)
Serial.printf("WARNING: IR code is too big for buffer (>= %d). "
"This result shouldn't be trusted until this is resolved. "
"Edit & increase CAPTURE_BUFFER_SIZE.\n",
CAPTURE_BUFFER_SIZE);
// Display the basic output of what we found.
Serial.print(resultToHumanReadableBasic(&results));
dumpACInfo(&results); // Display any extra A/C info if we have it.
yield(); // Feed the WDT as the text output can take a while to print.
// Display the library version the message was captured with.
Serial.print("Library : v");
Serial.println(_IRREMOTEESP8266_VERSION_);
Serial.println();
// Output RAW timing info of the result.
Serial.println(resultToTimingInfo(&results));
yield(); // Feed the WDT (again)
// Output the results as source code
Serial.println(resultToSourceCode(&results));
Serial.println(""); // Blank line between entries
yield(); // Feed the WDT (again)
}
}
@@ -4,7 +4,8 @@
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009,
* Copyright 2009 Ken Shirriff, http://arcfn.com
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -33,7 +34,9 @@
#include <IRremoteESP8266.h>
#include <IRsend.h>
IRsend irsend(4); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
// Example of data captured by IRrecvDumpV2.ino
uint16_t rawData[67] = {9000, 4500, 650, 550, 650, 1650, 600, 550, 650, 550,
@@ -50,13 +53,19 @@ void setup() {
}
void loop() {
#if SEND_NEC
Serial.println("NEC");
irsend.sendNEC(0x00FFE01FUL, 32);
#endif // SEND_NEC
delay(2000);
#if SEND_SONY
Serial.println("Sony");
irsend.sendSony(0xa90, 12, 2);
#endif // SEND_SONY
delay(2000);
#if SEND_RAW
Serial.println("a rawData capture from IRrecvDumpV2");
irsend.sendRaw(rawData, 67, 38); // Send a raw data capture at 38kHz.
#endif // SEND_RAW
delay(2000);
}
@@ -6,7 +6,7 @@
* Version 1.0 June, 2017
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2), unless you
* change the irsend() value below.
* change the IR_LED value below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -35,7 +35,9 @@
#include <IRremoteESP8266.h>
#include <IRsend.h>
IRsend irsend(4); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
// Panasonic Plasma TV Descrete code (Power On).
// Acquired from:
@@ -96,10 +98,15 @@ void setup() {
}
void loop() {
#if SEND_PRONTO
Serial.println("Sending a Samsung TV 'on' command.");
irsend.sendPronto(samsungProntoCode, 72);
delay(2000);
Serial.println("Sending a Panasonic Plasma TV 'on' command.");
irsend.sendPronto(panasonicProntoCode, 104);
delay(2000);
#else // SEND_PRONTO
Serial.println("Can't send because SEND_PRONTO has been disabled.");
delay(10000);
#endif // SEND_PRONTO
}
@@ -4,7 +4,8 @@
* Based on Ken Shirriff's IrsendDemo Version 0.1 July, 2009, Copyright 2009 Ken Shirriff, http://arcfn.com
* JVC and Panasonic protocol added by Kristian Lauszus (Thanks to zenwheel and other people at the original blog post)
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -38,7 +39,9 @@
#define JVCPower 0xC5E8
IRsend irsend(4); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
void setup() {
irsend.begin();
@@ -46,11 +49,19 @@ void setup() {
void loop() {
// This should turn your TV on and off
#if SEND_PANASONIC
irsend.sendPanasonic(PanasonicAddress, PanasonicPower);
#else // SEND_PANASONIC
Serial.println("Can't send because SEND_PANASONIC has been disabled.");
#endif // SEND_PANASONIC
#if SEND_JVC
irsend.sendJVC(JVCPower, 16, 0); // hex value, 16 bits, no repeat
// see http://www.sbprojects.com/knowledge/ir/jvc.php for information
delayMicroseconds(50);
irsend.sendJVC(JVCPower, 16, 1); // hex value, 16 bits, repeat
delayMicroseconds(50);
#else // SEND_JVC
Serial.println("Can't send because SEND_JVC has been disabled.");
#endif // SEND_JVC
}
@@ -45,7 +45,11 @@ void Ac_Send_Code(uint32_t code) {
Serial.print(" : ");
Serial.println(code, HEX);
#if SEND_LG
irsend.sendLG(code, 28);
#else // SEND_LG
Serial.println("Can't send because SEND_LG has been disabled.");
#endif // SEND_LG
}
void Ac_Activate(unsigned int temperature, unsigned int air_flow,
@@ -171,8 +175,8 @@ void loop() {
# 4 : air_flow 0 ~ 3 : flow
# + : temp + 1
# - : temp - 1
# c : cooling
# h : heating
# c : cooling
# h : heating
# m : change cooling to air clean, air clean to cooling
*/
Serial.print("a : ");
@@ -1,5 +1,6 @@
/* Copyright 2017 crankyoldgit
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -29,7 +30,8 @@
#include <IRsend.h>
#include <ir_Argo.h>
IRArgoAC argoir(4); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRArgoAC argoir(IR_LED); // Set the GPIO to be used to sending the message.
void setup() {
argoir.begin();
@@ -45,8 +47,12 @@ void loop() {
argoir.setCoolMode(ARGO_COOL_AUTO);
argoir.setTemp(25);
#if SEND_ARGO
// Now send the IR signal.
argoir.send();
#else // SEND_ARGO
Serial.println("Can't send because SEND_ARGO has been disabled.");
#endif // SEND_ARGO
delay(5000);
}
@@ -1,6 +1,7 @@
/* Copyright 2016 sillyfrog
/* Copyright 2017 sillyfrog
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -30,10 +31,11 @@
#include <IRsend.h>
#include <ir_Daikin.h>
IRDaikinESP dakinir(D2); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRDaikinESP daikinir(IR_LED); // Set the GPIO to be used to sending the message
void setup() {
dakinir.begin();
daikinir.begin();
Serial.begin(115200);
}
@@ -42,15 +44,26 @@ void loop() {
Serial.println("Sending...");
// Set up what we want to send. See ir_Daikin.cpp for all the options.
dakinir.on();
dakinir.setFan(1);
dakinir.setMode(DAIKIN_COOL);
dakinir.setTemp(25);
dakinir.setSwingVertical(0);
dakinir.setSwingHorizontal(0);
daikinir.on();
daikinir.setFan(1);
daikinir.setMode(DAIKIN_COOL);
daikinir.setTemp(25);
daikinir.setSwingVertical(false);
daikinir.setSwingHorizontal(false);
// Set the current time to 1:33PM (13:33)
// Time works in minutes past midnight
daikinir.setCurrentTime((13*60) + 33);
// Turn off about 1 hour later at 2:30PM (15:30)
daikinir.enableOffTimer((14*60) + 30);
// Display what we are going to send.
Serial.println(daikinir.toString());
// Now send the IR signal.
dakinir.send();
#if SEND_DAIKIN
daikinir.send();
#endif // SEND_DAIKIN
delay(5000);
delay(15000);
}
@@ -14,7 +14,7 @@ void printState() {
// Display the encoded IR sequence.
unsigned char* ir_code = fujitsu.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < FUJITSU_AC_STATE_LENGTH; i++)
for (uint8_t i = 0; i < fujitsu.getStateLength(); i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
@@ -24,7 +24,7 @@ void setup() {
Serial.begin(115200);
delay(200);
// Set up what we want to send. See ir_Mitsubishi.cpp for all the options.
// Set up what we want to send. See ir_Fujitsu.cpp for all the options.
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
@@ -38,7 +38,11 @@ void setup() {
void loop() {
// Now send the IR signal.
Serial.println("Sending IR command to A/C ...");
#if SEND_FUJITSU_AC
fujitsu.send();
#else // SEND_FUJITSU_AC
Serial.println("Can't send because SEND_FUJITSU_AC has been disabled.");
#endif // SEND_FUJITSU_AC
printState();
delay(5000);
}
@@ -1,6 +1,7 @@
/* Copyright 2016 David Conran
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -29,7 +30,8 @@
#include <IRsend.h>
#include <ir_Kelvinator.h>
IRKelvinatorAC kelvir(D2); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRKelvinatorAC kelvir(IR_LED); // Set the GPIO to be used for sending messages.
void printState() {
// Display the settings.
@@ -73,8 +75,10 @@ void setup() {
void loop() {
// Now send the IR signal.
#if SEND_KELVINATOR
Serial.println("Sending IR command to A/C ...");
kelvir.send();
#endif // SEND_KELVINATOR
printState();
delay(5000);
}
@@ -1,6 +1,7 @@
/* Copyright 2017 David Conran
*
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -29,7 +30,8 @@
#include <IRsend.h>
#include <ir_Mitsubishi.h>
IRMitsubishiAC mitsubir(D2); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRMitsubishiAC mitsubir(IR_LED); // Set the GPIO used for sending messages.
void printState() {
// Display the settings.
@@ -64,8 +66,10 @@ void setup() {
void loop() {
// Now send the IR signal.
#if SEND_MITSUBISHI_AC
Serial.println("Sending IR command to A/C ...");
mitsubir.send();
#endif // SEND_MITSUBISHI_AC
printState();
delay(5000);
}
@@ -0,0 +1,73 @@
/* Copyright 2017 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
* Suggested circuit:
* https://github.com/markszabo/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.
*/
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Toshiba.h>
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRToshibaAC toshibair(IR_LED); // Set the GPIO to be used for sending messages.
void printState() {
// Display the settings.
Serial.println("Toshiba A/C remote is in the following state:");
Serial.printf(" Power: %d, Mode: %d, Temp: %dC, Fan Speed: %d\n",
toshibair.getPower(), toshibair.getMode(), toshibair.getTemp(),
toshibair.getFan());
// Display the encoded IR sequence.
unsigned char* ir_code = toshibair.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < TOSHIBA_AC_STATE_LENGTH; i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup() {
toshibair.begin();
Serial.begin(115200);
delay(200);
// Set up what we want to send. See ir_Toshiba.cpp for all the options.
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
toshibair.on();
toshibair.setFan(1);
toshibair.setMode(TOSHIBA_AC_COOL);
toshibair.setTemp(26);
}
void loop() {
// Now send the IR signal.
#if SEND_TOSHIBA_AC
Serial.println("Sending IR command to A/C ...");
toshibair.send();
#endif // SEND_TOSHIBA_AC
printState();
delay(5000);
}
@@ -0,0 +1,17 @@
[platformio]
lib_extra_dirs = ../../
src_dir=.
[common]
build_flags =
lib_deps_builtin =
lib_deps_external =
[env:nodemcuv2]
platform = espressif8266
framework = arduino
board = nodemcuv2
build_flags = ${common.build_flags}
lib_deps =
${common.lib_deps_builtin}
${common.lib_deps_external}
@@ -1,5 +1,6 @@
/* Copyright 2017 stufisher
* An IR LED circuit *MUST* be connected to ESP8266 pin 4 (D2).
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -29,7 +30,8 @@
#include <IRsend.h>
#include <ir_Trotec.h>
IRTrotecESP trotecir(D2); // An IR LED is controlled by GPIO pin 4 (D2)
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRTrotecESP trotecir(IR_LED); // Set the GPIO to be used for sending messages.
void setup() {
trotecir.begin();
@@ -46,7 +48,11 @@ void loop() {
trotecir.setTemp(25);
// Now send the IR signal.
#if SEND_TROTEC
trotecir.send();
#else // SEND_TROTEC
Serial.println("Can't send because SEND_TROTEC has been disabled.");
#endif // SEND_TROTEC
delay(5000);
}