Update IRRemoteESP8266 version to 2.5.5

factorize IR send signal function between the 2 types of receiving
Add new IRRemoteESP8266 protocols
replace pins on mega according schema
remove unecessaries spaces
This commit is contained in:
Florian committed 2019-02-08 16:50:37 +01:00
1 parent 0180a0dbd5
commit f0305236db
149 files changed
+20957 -7850

No files matched your search

@@ -0,0 +1,99 @@
/* Copyright 2019 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/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_Samsung.h>
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRSamsungAc ac(kIrLed); // Set the GPIO used for sending messages.
void printState() {
// Display the settings.
Serial.println("Samsung A/C remote is in the following state:");
Serial.printf(" %s\n", ac.toString().c_str());
}
void setup() {
ac.begin();
Serial.begin(115200);
delay(200);
// Set up what we want to send. See ir_Samsung.cpp for all the options.
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting initial state for A/C.");
ac.off();
ac.setFan(kSamsungAcFanLow);
ac.setMode(kSamsungAcCool);
ac.setTemp(25);
ac.setSwing(false);
printState();
}
void loop() {
// Turn the A/C unit on and set to cooling mode.
// Power changes require we send an extended message.
Serial.println("Sending an extended IR command to A/C ...");
ac.on();
ac.setMode(kSamsungAcCool);
ac.sendExtended();
printState();
delay(15000); // wait 15 seconds
// Increase the fan speed.
Serial.println("Sending a normal IR command to A/C ...");
ac.setFan(kSamsungAcFanHigh);
ac.send();
printState();
delay(15000);
// Change to swing the fan.
Serial.println("Sending a normal IR command to A/C ...");
ac.setSwing(true);
ac.send();
printState();
delay(15000);
// Change to Fan mode, lower the speed, and stop the swing.
Serial.println("Sending a normal IR command to A/C ...");
ac.setSwing(false);
ac.setMode(kSamsungAcFan);
ac.setFan(kSamsungAcFanLow);
ac.send();
printState();
delay(15000);
// Turn the A/C unit off.
// Power changes require we send an extended message.
Serial.println("Sending an extended IR command to A/C ...");
ac.off();
ac.sendExtended();
printState();
delay(15000); // wait 15 seconds
}
@@ -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}
@@ -24,12 +24,13 @@
* 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.
* * 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 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.
@@ -45,11 +46,11 @@
// These codes can be found in GC's Control Tower database.
uint16_t Samsung_power_toggle[71] = {
38000, 1, 1, 170, 170, 20, 63, 20, 63, 20, 63, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 63, 20, 63, 20, 63, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
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};
38000, 1, 1, 170, 170, 20, 63, 20, 63, 20, 63, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 63, 20, 63, 20, 63, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 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};
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
@@ -64,7 +65,7 @@ void loop() {
Serial.println("Toggling power");
#if SEND_GLOBALCACHE
irsend.sendGC(Samsung_power_toggle, 71);
#else // SEND_GLOBALCACHE
#else // SEND_GLOBALCACHE
Serial.println("Can't send because SEND_GLOBALCACHE has been disabled.");
#endif // SEND_GLOBALCACHE
delay(10000);
@@ -9,7 +9,7 @@
* For more codes, visit: https://irdb.globalcache.com/
*
* How to use this program:
* 1) Update "ssid" and "password" below for your WIFI network.
* 1) Update "kSsid" and "kPassword" below for your WIFI network.
* 2) Compile and upload the sketch to your ESP8266 module.
* 3) (Optional) Use the serial connection to confirm it started and get the
* IP address.
@@ -46,8 +46,8 @@
#include <WiFiClient.h>
#include <WiFiServer.h>
const char* ssid = "..."; // Put your WIFI SSID here.
const char* password = "..."; // Put your WIFI password here.
const char* kSsid = "..."; // Put your WIFI SSID here.
const char* kPassword = "..."; // Put your WIFI Password here.
WiFiServer server(4998); // Uses port 4998.
WiFiClient client;
@@ -103,7 +103,7 @@ void setup() {
delay(100);
Serial.println(" ");
Serial.println("IR TCP Server");
WiFi.begin(ssid, password);
WiFi.begin(kSsid, kPassword);
while (WiFi.status() != WL_CONNECTED) {
delay(900);
Serial.print(".");
File diff suppressed because it is too large. Load diff
@@ -7,7 +7,7 @@ build_flags = -DMQTT_MAX_PACKET_SIZE=512
lib_deps_builtin =
lib_deps_external =
PubSubClient
WifiManager@0.12
WifiManager@0.14
[env:nodemcuv2]
platform = espressif8266
@@ -4,7 +4,7 @@
* Copyright 2015 Mark Szabo
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -36,15 +36,15 @@
#include <IRsend.h>
#include <WiFiClient.h>
const char* ssid = ".....";
const char* password = ".....";
const char* kSsid = ".....";
const char* kPassword = ".....";
MDNSResponder mdns;
ESP8266WebServer server(80);
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
void handleRoot() {
server.send(200, "text/html",
@@ -90,7 +90,7 @@ void setup(void) {
irsend.begin();
Serial.begin(115200);
WiFi.begin(ssid, password);
WiFi.begin(kSsid, kPassword);
Serial.println("");
// Wait for connection
@@ -100,7 +100,7 @@ void setup(void) {
}
Serial.println("");
Serial.print("Connected to ");
Serial.println(ssid);
Serial.println(kSsid);
Serial.print("IP address: ");
Serial.println(WiFi.localIP().toString());
@@ -3,7 +3,7 @@
* 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.
* An IR detector/demodulator must be connected to the input kRecvPin.
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Example circuit diagram:
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-receiving
@@ -25,9 +25,9 @@
// An IR detector/demodulator is connected to GPIO pin 14(D5 on a NodeMCU
// board).
uint16_t RECV_PIN = 14;
const uint16_t kRecvPin = 14;
IRrecv irrecv(RECV_PIN);
IRrecv irrecv(kRecvPin);
decode_results results;
@@ -38,7 +38,7 @@ void setup() {
delay(50);
Serial.println();
Serial.print("IRrecvDemo is now running and waiting for IR message on Pin ");
Serial.println(RECV_PIN);
Serial.println(kRecvPin);
}
void loop() {
@@ -86,10 +86,10 @@ void dump(decode_results *results) {
if (i % 100 == 0)
yield(); // Preemptive yield every 100th entry to feed the WDT.
if (i & 1) {
Serial.print(results->rawbuf[i] * RAWTICK, DEC);
Serial.print(results->rawbuf[i] * kRawTick, DEC);
} else {
Serial.print(", ");
Serial.print((uint32_t) results->rawbuf[i] * RAWTICK, DEC);
Serial.print((uint32_t) results->rawbuf[i] * kRawTick, DEC);
}
}
Serial.println("};");
@@ -1,6 +1,6 @@
/*
* IRremoteESP8266: IRrecvDumpV2 - dump details of IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* An IR detector/demodulator must be connected to the input kRecvPin.
*
* Copyright 2009 Ken Shirriff, http://arcfn.com
* Copyright 2017 David Conran
@@ -9,6 +9,8 @@
* https://github.com/markszabo/IRremoteESP8266/wiki#ir-receiving
*
* Changes:
* Version 0.4 July, 2018
* - Minor improvements and more A/C unit support.
* Version 0.3 November, 2017
* - Support for A/C decoding for some protcols.
* Version 0.2 April, 2017
@@ -20,36 +22,43 @@
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRremoteESP8266.h>
#include <IRutils.h>
#if DECODE_AC
// The following are only needed for extended decoding of A/C Messages
#include <ir_Coolix.h>
#include <ir_Daikin.h>
#include <ir_Fujitsu.h>
#include <ir_Gree.h>
#include <ir_Haier.h>
#include <ir_Hitachi.h>
#include <ir_Kelvinator.h>
#include <ir_Midea.h>
#include <ir_Mitsubishi.h>
#include <ir_Panasonic.h>
#include <ir_Samsung.h>
#include <ir_Toshiba.h>
#endif // DECODE_AC
#include <ir_Vestel.h>
#include <ir_Whirlpool.h>
// ==================== 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
const uint16_t kRecvPin = 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
const uint32_t kBaudRate = 115200;
// 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.
#define CAPTURE_BUFFER_SIZE 1024
const uint16_t kCaptureBufferSize = 1024;
// TIMEOUT is the Nr. of milli-Seconds of no-more-data before we consider a
// kTimeout 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
@@ -61,33 +70,34 @@
// 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
// So, choosing the best kTimeout value for your use particular case is
// quite nuanced. Good luck and happy hunting.
// NOTE: Don't exceed MAX_TIMEOUT_MS. Typically 130ms.
// NOTE: Don't exceed kMaxTimeoutMs. Typically 130ms.
#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.
// Some A/C units have gaps in their protocols of ~40ms. e.g. Kelvinator
// A value this large may swallow repeats of some protocols
const uint8_t kTimeout = 50;
#else // DECODE_AC
// Suits most messages, while not swallowing many repeats.
const uint8_t kTimeout = 15;
#endif // DECODE_AC
// Alternatives:
// #define TIMEOUT 90U // Suits messages with big gaps like XMP-1 & some aircon
// 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.
// const uint8_t kTimeout = 90;
// Suits messages with big gaps like XMP-1 & some aircon units, but can
// accidentally swallow repeated messages in the rawData[] output.
//
// const uint8_t kTimeout = kMaxTimeoutMs;
// 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)
// as a message increases with the length of the kTimeout 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.
//
@@ -96,12 +106,11 @@
// 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
const uint16_t kMinUnknownSize = 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);
IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true);
decode_results results; // Somewhere to store the results
@@ -115,6 +124,13 @@ void dumpACInfo(decode_results *results) {
description = ac.toString();
}
#endif // DECODE_DAIKIN
#if DECODE_DAIKIN2
if (results->decode_type == DAIKIN2) {
IRDaikin2 ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_DAIKIN2
#if DECODE_FUJITSU_AC
if (results->decode_type == FUJITSU_AC) {
IRFujitsuAC ac(0);
@@ -129,6 +145,13 @@ void dumpACInfo(decode_results *results) {
description = ac.toString();
}
#endif // DECODE_KELVINATOR
#if DECODE_MITSUBISHI_AC
if (results->decode_type == MITSUBISHI_AC) {
IRMitsubishiAC ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_MITSUBISHI_AC
#if DECODE_TOSHIBA_AC
if (results->decode_type == TOSHIBA_AC) {
IRToshibaAC ac(0);
@@ -157,23 +180,73 @@ void dumpACInfo(decode_results *results) {
description = ac.toString();
}
#endif // DECODE_HAIER_AC
#if DECODE_HAIER_AC_YRW02
if (results->decode_type == HAIER_AC_YRW02) {
IRHaierACYRW02 ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_HAIER_AC_YRW02
#if DECODE_SAMSUNG_AC
if (results->decode_type == SAMSUNG_AC) {
IRSamsungAc ac(0);
ac.setRaw(results->state, results->bits / 8);
description = ac.toString();
}
#endif // DECODE_SAMSUNG_AC
#if DECODE_COOLIX
if (results->decode_type == COOLIX) {
IRCoolixAC ac(0);
ac.setRaw(results->value); // Coolix uses value instead of state.
description = ac.toString();
}
#endif // DECODE_COOLIX
#if DECODE_PANASONIC_AC
if (results->decode_type == PANASONIC_AC &&
results->bits > kPanasonicAcShortBits) {
IRPanasonicAc ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_PANASONIC_AC
#if DECODE_HITACHI_AC
if (results->decode_type == HITACHI_AC) {
IRHitachiAc ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_HITACHI_AC
#if DECODE_WHIRLPOOL_AC
if (results->decode_type == WHIRLPOOL_AC) {
IRWhirlpoolAc ac(0);
ac.setRaw(results->state);
description = ac.toString();
}
#endif // DECODE_WHIRLPOOL_AC
#if DECODE_VESTEL_AC
if (results->decode_type == VESTEL_AC) {
IRVestelAC ac(0);
ac.setRaw(results->value); // Like Coolix, use value instead of state.
description = ac.toString();
}
#endif // DECODE_VESTEL_AC
// If we got a human-readable description of the message, display it.
if (description != "") Serial.println("Mesg Desc.: " + description);
if (description != "") Serial.println("Mesg Desc.: " + description);
}
// The section of code run only once at start-up.
void setup() {
Serial.begin(BAUD_RATE, SERIAL_8N1, SERIAL_TX_ONLY);
Serial.begin(kBaudRate, 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);
Serial.println(kRecvPin);
#if DECODE_HASH
// Ignore messages with less than minimum on or off pulses.
irrecv.setUnknownThreshold(MIN_UNKNOWN_SIZE);
#endif // DECODE_HASH
irrecv.setUnknownThreshold(kMinUnknownSize);
#endif // DECODE_HASH
irrecv.enableIRIn(); // Start the receiver
}
@@ -186,10 +259,11 @@ void loop() {
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);
Serial.printf(
"WARNING: IR code is too big for buffer (>= %d). "
"This result shouldn't be trusted until this is resolved. "
"Edit & increase kCaptureBufferSize.\n",
kCaptureBufferSize);
// Display the basic output of what we found.
Serial.print(resultToHumanReadableBasic(&results));
dumpACInfo(&results); // Display any extra A/C info if we have it.
@@ -207,6 +281,6 @@ void loop() {
// Output the results as source code
Serial.println(resultToSourceCode(&results));
Serial.println(""); // Blank line between entries
yield(); // Feed the WDT (again)
yield(); // Feed the WDT (again)
}
}
@@ -1,11 +1,11 @@
/* IRremoteESP8266: IRsendDemo - demonstrates sending IR codes with IRsend.
*
* Version 1.0 April, 2017
* Version 1.1 January, 2019
* 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 the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -34,9 +34,9 @@
#include <IRremoteESP8266.h>
#include <IRsend.h>
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
IRsend irsend(kIrLed); // 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,
@@ -46,6 +46,10 @@ uint16_t rawData[67] = {9000, 4500, 650, 550, 650, 1650, 600, 550, 650, 550,
650, 550, 650, 550, 600, 550, 650, 550, 650, 550,
650, 1650, 600, 550, 650, 1650, 650, 1650, 650, 1650,
650, 1650, 650, 1650, 650, 1650, 600};
// Example Samsung A/C state captured from IRrecvDumpV2.ino
uint8_t samsungState[kSamsungAcStateLength] = {
0x02, 0x92, 0x0F, 0x00, 0x00, 0x00, 0xF0,
0x01, 0xE2, 0xFE, 0x71, 0x40, 0x11, 0xF0};
void setup() {
irsend.begin();
@@ -53,19 +57,16 @@ void setup() {
}
void loop() {
#if SEND_NEC
Serial.println("NEC");
irsend.sendNEC(0x00FFE01FUL, 32);
#endif // SEND_NEC
irsend.sendNEC(0x00FFE01FUL);
delay(2000);
#if SEND_SONY
Serial.println("Sony");
irsend.sendSony(0xa90, 12, 2);
#endif // SEND_SONY
irsend.sendSony(0xa90, 12, 2); // 12 bits & 2 repeats
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);
Serial.println("a Samsung A/C state from IRrecvDumpV2");
irsend.sendSamsungAC(samsungState);
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 IR_LED value below.
* change the kIrLed value below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -35,9 +35,9 @@
#include <IRremoteESP8266.h>
#include <IRsend.h>
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(IR_LED); // Set the GPIO to be used to sending the message.
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
// Panasonic Plasma TV Descrete code (Power On).
// Acquired from:
@@ -5,7 +5,7 @@
* 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 the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -34,14 +34,13 @@
#include <IRremoteESP8266.h>
#include <IRsend.h>
#define PanasonicAddress 0x4004 // Panasonic address (Pre data)
#define PanasonicPower 0x100BCBD // Panasonic Power button
const uint16_t kPanasonicAddress = 0x4004; // Panasonic address (Pre data)
const uint32_t kPanasonicPower = 0x100BCBD; // Panasonic Power button
const uint16_t kJVCPower = 0xC5E8;
#define JVCPower 0xC5E8
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 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.
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
void setup() {
irsend.begin();
@@ -50,18 +49,15 @@ void setup() {
void loop() {
// This should turn your TV on and off
#if SEND_PANASONIC
irsend.sendPanasonic(PanasonicAddress, PanasonicPower);
irsend.sendPanasonic(kPanasonicAddress, kPanasonicPower);
#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);
irsend.sendJVC(kJVCPower, 16, 1); // hex value, 16 bits, single repeat
#else // SEND_JVC
Serial.println("Can't send because SEND_JVC has been disabled.");
#endif // SEND_JVC
delay(10000); // Wait 10 seconds before we repeat everything.
}
@@ -64,9 +64,9 @@ void Ac_Activate(unsigned int temperature, unsigned int air_flow,
else
ac_msbits4 = 0; // cooling
unsigned int ac_msbits5 = (temperature < 15) ? 0 : temperature - 15;
unsigned int ac_msbits6;
unsigned int ac_msbits6 = 0;
if (0 <= air_flow && air_flow <= 2) {
if (air_flow <= 2) {
if (kAc_Type == 0)
ac_msbits6 = kAc_Flow_Tower[air_flow];
else
@@ -132,7 +132,7 @@ void setup() {
}
void loop() {
char b;
char b = ' ';
Serial.println("# a : mode or temp b : air_flow, temp, swing, clean,"
" cooling/heating");
Serial.println("# 0 : off 0");
@@ -162,7 +162,7 @@ void loop() {
default:
Serial.println("b="); // Prompt User for input
while (Serial.available() == 0) {}
char b = Serial.read();
b = Serial.read();
}
/*
@@ -198,7 +198,7 @@ void loop() {
Ac_Change_Air_Swing(1);
break;
case '3': // 1 : clean on, power on
if (b == '0' | b == '1')
if (b == '0' || b == '1')
Ac_Air_Clean(b);
break;
case '4':
@@ -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,6 +1,6 @@
/* Copyright 2017 crankyoldgit
/* Copyright 2017, 2018 crankyoldgit
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -30,11 +30,11 @@
#include <IRsend.h>
#include <ir_Argo.h>
#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.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRArgoAC ac(kIrLed); // Set the GPIO to be used to sending the message.
void setup() {
argoir.begin();
ac.begin();
Serial.begin(115200);
}
@@ -42,14 +42,14 @@ void loop() {
Serial.println("Sending...");
// Set up what we want to send. See ir_Argo.cpp for all the options.
argoir.setPower(true);
argoir.setFan(ARGO_FAN_1);
argoir.setCoolMode(ARGO_COOL_AUTO);
argoir.setTemp(25);
ac.setPower(true);
ac.setFan(kArgoFan1);
ac.setCoolMode(kArgoCoolAuto);
ac.setTemp(25);
#if SEND_ARGO
// Now send the IR signal.
argoir.send();
ac.send();
#else // SEND_ARGO
Serial.println("Can't send because SEND_ARGO has been disabled.");
#endif // SEND_ARGO
@@ -1,7 +1,7 @@
/* Copyright 2017 sillyfrog
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -31,11 +31,11 @@
#include <IRsend.h>
#include <ir_Daikin.h>
#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
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRDaikinESP ac(kIrLed); // Set the GPIO to be used to sending the message
void setup() {
daikinir.begin();
ac.begin();
Serial.begin(115200);
}
@@ -44,25 +44,25 @@ void loop() {
Serial.println("Sending...");
// Set up what we want to send. See ir_Daikin.cpp for all the options.
daikinir.on();
daikinir.setFan(1);
daikinir.setMode(DAIKIN_COOL);
daikinir.setTemp(25);
daikinir.setSwingVertical(false);
daikinir.setSwingHorizontal(false);
ac.on();
ac.setFan(1);
ac.setMode(kDaikinCool);
ac.setTemp(25);
ac.setSwingVertical(false);
ac.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);
ac.setCurrentTime(13 * 60 + 33);
// Turn off about 1 hour later at 2:30PM (14:30)
ac.enableOffTimer(14 * 60 + 30);
// Display what we are going to send.
Serial.println(daikinir.toString());
Serial.println(ac.toString());
// Now send the IR signal.
#if SEND_DAIKIN
daikinir.send();
ac.send();
#endif // SEND_DAIKIN
delay(15000);
@@ -1,26 +1,28 @@
// Copyright 2017 Jonny Graham
// Copyright 2017 Jonny Graham, 2018 David Conran
#ifndef UNIT_TEST
#include <Arduino.h>
#endif
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <ir_Fujitsu.h>
IRFujitsuAC fujitsu(5); // IR led controlled by Pin D1.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRFujitsuAC ac(kIrLed);
void printState() {
// Display the settings.
Serial.println("Fujitsu A/C remote is in the following state:");
Serial.printf(" Command:%d, Mode: %d, Temp: %dC, Fan Speed: %d," \
" Swing Mode: %d\n",
fujitsu.getCmd(), fujitsu.getMode(), fujitsu.getTemp(),
fujitsu.getFanSpeed(), fujitsu.getSwing());
Serial.printf(" %s\n", ac.toString().c_str());
// Display the encoded IR sequence.
unsigned char* ir_code = fujitsu.getRaw();
unsigned char* ir_code = ac.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < fujitsu.getStateLength(); i++)
for (uint8_t i = 0; i < ac.getStateLength(); i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup() {
fujitsu.begin();
ac.begin();
Serial.begin(115200);
delay(200);
@@ -28,18 +30,18 @@ void setup() {
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
fujitsu.setCmd(FUJITSU_AC_CMD_TURN_ON);
fujitsu.setSwing(FUJITSU_AC_SWING_BOTH);
fujitsu.setMode(FUJITSU_AC_MODE_COOL);
fujitsu.setFanSpeed(FUJITSU_AC_FAN_HIGH);
fujitsu.setTemp(24);
ac.setCmd(kFujitsuAcCmdTurnOn);
ac.setSwing(kFujitsuAcSwingBoth);
ac.setMode(kFujitsuAcModeCool);
ac.setFanSpeed(kFujitsuAcFanHigh);
ac.setTemp(24); // 24C
}
void loop() {
// Now send the IR signal.
Serial.println("Sending IR command to A/C ...");
#if SEND_FUJITSU_AC
fujitsu.send();
ac.send();
#else // SEND_FUJITSU_AC
Serial.println("Can't send because SEND_FUJITSU_AC has been disabled.");
#endif // SEND_FUJITSU_AC
@@ -1,7 +1,7 @@
/* Copyright 2016 David Conran
/* Copyright 2016, 2018 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -30,30 +30,23 @@
#include <IRsend.h>
#include <ir_Kelvinator.h>
#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.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRKelvinatorAC ac(kIrLed); // Set the GPIO to be used for sending messages.
void printState() {
// Display the settings.
Serial.println("Kelvinator A/C remote is in the following state:");
Serial.printf(" Basic\n Power: %d, Mode: %d, Temp: %dC, Fan Speed: %d\n",
kelvir.getPower(), kelvir.getMode(), kelvir.getTemp(),
kelvir.getFan());
Serial.printf(" Options\n X-Fan: %d, Light: %d, Ion Filter: %d\n",
kelvir.getXFan(), kelvir.getLight(), kelvir.getIonFilter());
Serial.printf(" Swing (V): %d, Swing (H): %d, Turbo: %d, Quiet: %d\n",
kelvir.getSwingVertical(), kelvir.getSwingHorizontal(),
kelvir.getTurbo(), kelvir.getQuiet());
Serial.printf(" %s\n", ac.toString().c_str());
// Display the encoded IR sequence.
unsigned char* ir_code = kelvir.getRaw();
unsigned char* ir_code = ac.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < KELVINATOR_STATE_LENGTH; i++)
for (uint8_t i = 0; i < kKelvinatorStateLength; i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup() {
kelvir.begin();
ac.begin();
Serial.begin(115200);
delay(200);
@@ -62,22 +55,22 @@ void setup() {
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
kelvir.on();
kelvir.setFan(1);
kelvir.setMode(KELVINATOR_COOL);
kelvir.setTemp(26);
kelvir.setSwingVertical(false);
kelvir.setSwingHorizontal(true);
kelvir.setXFan(true);
kelvir.setIonFilter(false);
kelvir.setLight(true);
ac.on();
ac.setFan(1);
ac.setMode(kKelvinatorCool);
ac.setTemp(26);
ac.setSwingVertical(false);
ac.setSwingHorizontal(true);
ac.setXFan(true);
ac.setIonFilter(false);
ac.setLight(true);
}
void loop() {
// Now send the IR signal.
#if SEND_KELVINATOR
Serial.println("Sending IR command to A/C ...");
kelvir.send();
ac.send();
#endif // SEND_KELVINATOR
printState();
delay(5000);
@@ -1,7 +1,7 @@
/* Copyright 2017 David Conran
/* Copyright 2017, 2018 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -30,26 +30,23 @@
#include <IRsend.h>
#include <ir_Mitsubishi.h>
#define IR_LED 4 // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRMitsubishiAC mitsubir(IR_LED); // Set the GPIO used for sending messages.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRMitsubishiAC 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(" Power: %d, Mode: %d, Temp: %dC, Fan Speed: %d," \
" Vane Mode: %d\n",
mitsubir.getPower(), mitsubir.getMode(), mitsubir.getTemp(),
mitsubir.getFan(), mitsubir.getVane());
Serial.printf(" %s\n", ac.toString().c_str());
// Display the encoded IR sequence.
unsigned char* ir_code = mitsubir.getRaw();
unsigned char* ir_code = ac.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < MITSUBISHI_AC_STATE_LENGTH; i++)
for (uint8_t i = 0; i < kMitsubishiACStateLength; i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup() {
mitsubir.begin();
ac.begin();
Serial.begin(115200);
delay(200);
@@ -57,18 +54,18 @@ void setup() {
Serial.println("Default state of the remote.");
printState();
Serial.println("Setting desired state for A/C.");
mitsubir.on();
mitsubir.setFan(1);
mitsubir.setMode(MITSUBISHI_AC_COOL);
mitsubir.setTemp(26);
mitsubir.setVane(MITSUBISHI_AC_VANE_AUTO);
ac.on();
ac.setFan(1);
ac.setMode(kMitsubishiAcCool);
ac.setTemp(26);
ac.setVane(kMitsubishiAcVaneAuto);
}
void loop() {
// Now send the IR signal.
#if SEND_MITSUBISHI_AC
Serial.println("Sending IR command to A/C ...");
mitsubir.send();
ac.send();
#endif // SEND_MITSUBISHI_AC
printState();
delay(5000);
@@ -1,7 +1,7 @@
/* Copyright 2017 David Conran
/* Copyright 2017, 2018 David Conran
*
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -30,25 +30,23 @@
#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.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRToshibaAC ac(kIrLed); // 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());
Serial.printf(" %s\n", ac.toString().c_str());
// Display the encoded IR sequence.
unsigned char* ir_code = toshibair.getRaw();
unsigned char* ir_code = ac.getRaw();
Serial.print("IR Code: 0x");
for (uint8_t i = 0; i < TOSHIBA_AC_STATE_LENGTH; i++)
for (uint8_t i = 0; i < kToshibaACStateLength; i++)
Serial.printf("%02X", ir_code[i]);
Serial.println();
}
void setup() {
toshibair.begin();
ac.begin();
Serial.begin(115200);
delay(200);
@@ -56,17 +54,17 @@ void setup() {
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);
ac.on();
ac.setFan(1);
ac.setMode(kToshibaAcCool);
ac.setTemp(26);
}
void loop() {
// Now send the IR signal.
#if SEND_TOSHIBA_AC
Serial.println("Sending IR command to A/C ...");
toshibair.send();
ac.send();
#endif // SEND_TOSHIBA_AC
printState();
delay(5000);
@@ -1,6 +1,6 @@
/* Copyright 2017 stufisher
* An IR LED circuit *MUST* be connected to the ESP8266 on a pin
* as specified by IR_LED below.
* as specified by kIrLed below.
*
* TL;DR: The IR LED needs to be driven by a transistor for a good result.
*
@@ -30,11 +30,11 @@
#include <IRsend.h>
#include <ir_Trotec.h>
#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.
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRTrotecESP ac(kIrLed); // Set the GPIO to be used for sending messages.
void setup() {
trotecir.begin();
ac.begin();
Serial.begin(115200);
}
@@ -42,14 +42,14 @@ void loop() {
Serial.println("Sending...");
// Set up what we want to send. See ir_Trotec.cpp for all the options.
trotecir.setPower(true);
trotecir.setSpeed(TROTEC_FAN_LOW);
trotecir.setMode(TROTEC_COOL);
trotecir.setTemp(25);
ac.setPower(true);
ac.setSpeed(kTrotecFanLow);
ac.setMode(kTrotecCool);
ac.setTemp(25);
// Now send the IR signal.
#if SEND_TROTEC
trotecir.send();
ac.send();
#else // SEND_TROTEC
Serial.println("Can't send because SEND_TROTEC has been disabled.");
#endif // SEND_TROTEC