mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-09-27 09:18:21 +00:00
.
MQTT SSL channel
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
#define MQTT_IOT_CHANNEL_OUTPUT_SWITCH_1 "node1/output/sw1"
|
#define MQTT_IOT_CHANNEL_OUTPUT_SWITCH_1 "node1/output/sw1"
|
||||||
#define MQTT_IOT_CHANNEL_OUTPUT_SWITCH_2 "node1/sw2"
|
#define MQTT_IOT_CHANNEL_OUTPUT_SWITCH_2 "node1/sw2"
|
||||||
#define MQTT_IOT_CHANNEL_OUTPUT_PWM_1 "node1/pwm1"
|
#define MQTT_IOT_CHANNEL_OUTPUT_PWM_1 "node1/pwm1"
|
||||||
|
#define MQTT_IOT_CHANNEL_0 "test_topic"
|
||||||
|
|
||||||
// Uncomment corresponding board
|
// Uncomment corresponding board
|
||||||
//#define devkit_30pin_001
|
//#define devkit_30pin_001
|
||||||
@@ -75,7 +76,7 @@ D13 28 => Assigned to read RPM
|
|||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
*/
|
*/
|
||||||
#define PING_PIN 33 // GPIO 33 pin # of audio ping
|
#define PING_PIN 33 // GPIO 33 pin # of audio ping
|
||||||
#define LED_PIN 32
|
#define LED_PIN 33
|
||||||
#define SWITCH_1 14 // GPIO 14
|
#define SWITCH_1 14 // GPIO 14
|
||||||
#define SWITCH_2 12 // GPIO 12
|
#define SWITCH_2 12 // GPIO 12
|
||||||
#define DAC_CH1 25 // GPIO 25
|
#define DAC_CH1 25 // GPIO 25
|
||||||
|
@@ -22,6 +22,7 @@ struct {
|
|||||||
float pressure = 0.0;
|
float pressure = 0.0;
|
||||||
float temperature = 0.0;
|
float temperature = 0.0;
|
||||||
} sensors_values;
|
} sensors_values;
|
||||||
|
char cstr[16];
|
||||||
|
|
||||||
// Sensors modules specified in config.h file.
|
// Sensors modules specified in config.h file.
|
||||||
// BME280
|
// BME280
|
||||||
@@ -358,14 +359,14 @@ void loop() {
|
|||||||
Serial.println(connection.state()); // state() == 0 => Connected to MQTT
|
Serial.println(connection.state()); // state() == 0 => Connected to MQTT
|
||||||
Serial.print("MQTT Connected: ");
|
Serial.print("MQTT Connected: ");
|
||||||
Serial.println(connection.connected()); // connected() == 1 => Connected to MQTT
|
Serial.println(connection.connected()); // connected() == 1 => Connected to MQTT
|
||||||
Serial.print("Wi-Fi Connection tatus: ");
|
Serial.print("Wi-Fi Connection status: ");
|
||||||
Serial.println(WiFi.status()); // status() == 3 => Connected to WiFi
|
Serial.println(WiFi.status()); // status() == 3 => Connected to WiFi
|
||||||
delay(1000);
|
delay(1000);
|
||||||
connection.loop();
|
connection.loop();
|
||||||
|
|
||||||
digitalWrite(PING_PIN, LOW);
|
digitalWrite(PING_PIN, LOW);
|
||||||
digitalWrite(PING_PIN, HIGH);
|
digitalWrite(PING_PIN, HIGH);
|
||||||
delay(250);
|
delay(150);
|
||||||
digitalWrite(PING_PIN, LOW);
|
digitalWrite(PING_PIN, LOW);
|
||||||
}
|
}
|
||||||
// Call function to establish connection if not connected to MQTT server.
|
// Call function to establish connection if not connected to MQTT server.
|
||||||
|
Reference in New Issue
Block a user