update examples

This commit is contained in:
Dawid Chyrzynski
2021-01-07 21:55:35 +01:00
parent e1b5206c46
commit a3954e71be
4 changed files with 14 additions and 9 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
#include <Ethernet.h>
#include <ArduinoHA.h>
#define INPUT_PIN 9
#define INPUT_PIN 9
#define BROKER_ADDR IPAddress(192,168,0,17)
byte mac[] = {0x00, 0x10, 0xFA, 0x6E, 0x38, 0x4A};
unsigned long lastReadAt = millis();
@@ -24,7 +25,7 @@ void setup() {
device.setSoftwareVersion("1.0.0");
// please change IP address to yours
mqtt.begin(IPAddress(192,168,0,17));
mqtt.begin(BROKER_ADDR);
}
void loop() {
+3 -2
View File
@@ -1,7 +1,8 @@
#include <Ethernet.h>
#include <ArduinoHA.h>
#define LED_PIN 9
#define LED_PIN 9
#define BROKER_ADDR IPAddress(192,168,0,17)
byte mac[] = {0x00, 0x10, 0xFA, 0x6E, 0x38, 0x4A};
@@ -30,7 +31,7 @@ void setup() {
led.onStateChanged(onSwitchStateChanged);
// please change IP address to yours
mqtt.begin(IPAddress(192,168,0,17));
mqtt.begin(BROKER_ADDR);
}
void loop() {
@@ -1,9 +1,10 @@
#include <Ethernet.h>
#include <ArduinoHA.h>
#define LED_PIN 9
#define USERNAME "user" // replace with your credentials
#define PASSWORD "pass"
#define LED_PIN 9
#define BROKER_ADDR IPAddress(192,168,0,17)
#define BROKER_USERNAME "user" // replace with your credentials
#define BROKER_PASSWORD "pass"
byte mac[] = {0x00, 0x10, 0xFA, 0x6E, 0x38, 0x4A};
@@ -32,7 +33,7 @@ void setup() {
led.onStateChanged(onSwitchStateChanged);
// please change IP address to yours
mqtt.begin(IPAddress(192,168,0,17), USERNAME, PASSWORD);
mqtt.begin(BROKER_ADDR, BROKER_USERNAME, BROKER_PASSWORD);
}
void loop() {
+3 -1
View File
@@ -1,6 +1,8 @@
#include <Ethernet.h>
#include <ArduinoHA.h>
#define BROKER_ADDR IPAddress(192,168,0,17)
byte mac[] = {0x00, 0x10, 0xFA, 0x6E, 0x38, 0x4A};
unsigned long lastSentAt = millis();
double lastValue = 0;
@@ -34,7 +36,7 @@ void setup() {
temp.setUnitOfMeasurement("°C");
// please change IP address to yours
mqtt.begin(IPAddress(192,168,0,17));
mqtt.begin(BROKER_ADDR);
}
void loop() {