5.9.1f * Upgrade library ArduinoJson to 5.11.2 * Upgrade library IRRemoteEsp8266 to 2.2.1 + 2 commits but tweaked some protocols to keep code usage small * Upgrade library NeoPixelBus to 2.2.9 * Upgrade library OneWire to 2.3.3 + 6 commits * Formalize library PubSubClient to 2.6 + 9 commits and additional delay * Add optional ADS1115 driver as alternative for unsupported I2Cdevlib in esp8266-core 2.4.0-rc2 * Fix wrong response name for command HlwISet (#1214)
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
// Copyright 2017 Jonny Graham
|
|
#include <IRsend.h>
|
|
#include <ir_Fujitsu.h>
|
|
|
|
IRFujitsuAC fujitsu(5); // IR led controlled by Pin D1.
|
|
|
|
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());
|
|
// 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++)
|
|
Serial.printf("%02X", ir_code[i]);
|
|
Serial.println();
|
|
}
|
|
|
|
void setup() {
|
|
fujitsu.begin();
|
|
Serial.begin(115200);
|
|
delay(200);
|
|
|
|
// Set up what we want to send. See ir_Mitsubishi.cpp for all the options.
|
|
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);
|
|
}
|
|
|
|
void loop() {
|
|
// Now send the IR signal.
|
|
Serial.println("Sending IR command to A/C ...");
|
|
fujitsu.send();
|
|
printState();
|
|
delay(5000);
|
|
}
|