just some reformatting - no code changes
This commit is contained in:
@@ -1,15 +1,13 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <IRrecv.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <IRsend.h>
|
|
||||||
#include <IRremoteESP8266.h>
|
|
||||||
#include <IRac.h>
|
#include <IRac.h>
|
||||||
|
#include <IRrecv.h>
|
||||||
|
#include <IRremoteESP8266.h>
|
||||||
|
#include <IRsend.h>
|
||||||
#include <IRtext.h>
|
#include <IRtext.h>
|
||||||
#include <IRutils.h>
|
#include <IRutils.h>
|
||||||
|
|
||||||
#include <ESP8266WiFi.h>
|
|
||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
|
|
||||||
|
|
||||||
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
|
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
|
||||||
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
|
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
|
||||||
|
|
||||||
@@ -30,7 +28,6 @@ const uint16_t kMinUnknownSize = 12;
|
|||||||
IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true);
|
IRrecv irrecv(kRecvPin, kCaptureBufferSize, kTimeout, true);
|
||||||
decode_results results; // Somewhere to store the results
|
decode_results results; // Somewhere to store the results
|
||||||
|
|
||||||
|
|
||||||
// Update these with values suitable for your network.
|
// Update these with values suitable for your network.
|
||||||
const char *ssid = "JoNelsDarlings";
|
const char *ssid = "JoNelsDarlings";
|
||||||
const char *password = "Paris2016";
|
const char *password = "Paris2016";
|
||||||
@@ -46,7 +43,6 @@ char msg[MSG_BUFFER_SIZE];
|
|||||||
int value = 0;
|
int value = 0;
|
||||||
|
|
||||||
void setup_wifi() {
|
void setup_wifi() {
|
||||||
|
|
||||||
delay(10);
|
delay(10);
|
||||||
// We start by connecting to a WiFi network
|
// We start by connecting to a WiFi network
|
||||||
Serial.println();
|
Serial.println();
|
||||||
@@ -157,13 +153,10 @@ void setup() {
|
|||||||
#endif // DECODE_HASH
|
#endif // DECODE_HASH
|
||||||
irrecv.enableIRIn(); // Start the receiver
|
irrecv.enableIRIn(); // Start the receiver
|
||||||
|
|
||||||
|
|
||||||
irsend.begin();
|
irsend.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
if (!client.connected()) {
|
if (!client.connected()) {
|
||||||
reconnect();
|
reconnect();
|
||||||
}
|
}
|
||||||
@@ -195,14 +188,11 @@ void loop() {
|
|||||||
theSrc = resultToSourceCode(&results);
|
theSrc = resultToSourceCode(&results);
|
||||||
Serial.println(theSrc.c_str());
|
Serial.println(theSrc.c_str());
|
||||||
|
|
||||||
|
bool isPub = client.publish(String(room_name + "/ReceivedIR").c_str(),
|
||||||
bool isPub = client.publish(String(room_name + "/ReceivedIR").c_str(), theSrc.c_str());
|
theSrc.c_str());
|
||||||
if (isPub)
|
if (isPub)
|
||||||
Serial.println("PUBLISHED");
|
Serial.println("PUBLISHED");
|
||||||
else
|
else
|
||||||
Serial.println("PUBLISH FAILED");
|
Serial.println("PUBLISH FAILED");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user