Merge branch 'main' of https://projects.cloudsucks.net/asco.fablab/BrainBlast
This commit is contained in:
commit
b83aee3a6f
@ -2,11 +2,13 @@
|
|||||||
#include <PubSubClient.h>
|
#include <PubSubClient.h>
|
||||||
|
|
||||||
// Configurations WiFi et MQTT
|
// Configurations WiFi et MQTT
|
||||||
const char* ssid = "Redmi Note 13 Pro 5G";
|
const char* ssid = "fablab";
|
||||||
const char* password = "1234567890";
|
const char* password = "geek make code do";
|
||||||
const char* mqtt_server = "192.168.127.208";
|
const char* mqtt_server = "192.168.73.20";
|
||||||
const char* mqtt_topic = "brainblast/buzzer/pressed/1";
|
const char* mqtt_topic = "brainblast/buzzer/pressed/1";
|
||||||
const char* mqtt_message = "{\"buzzer_id\": 1, \"color\": \"#FF7518\"}";
|
const char* mqtt_message = "{\"buzzer_id\": 1, \"color\": \"#FF7518\"}";
|
||||||
|
//hostname wifi et client id mqtt
|
||||||
|
const char* esp_name = "BUZZER-1";
|
||||||
|
|
||||||
// Déclaration des broches
|
// Déclaration des broches
|
||||||
#define BUTTON_PIN D8
|
#define BUTTON_PIN D8
|
||||||
@ -18,6 +20,7 @@ void setup_wifi() {
|
|||||||
delay(10);
|
delay(10);
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.print("Connexion au WiFi...");
|
Serial.print("Connexion au WiFi...");
|
||||||
|
WiFi.hostname(esp_name);
|
||||||
WiFi.begin(ssid, password);
|
WiFi.begin(ssid, password);
|
||||||
|
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
@ -34,7 +37,7 @@ void setup_wifi() {
|
|||||||
void reconnect() {
|
void reconnect() {
|
||||||
while (!client.connected()) {
|
while (!client.connected()) {
|
||||||
Serial.print("Connexion au broker MQTT...");
|
Serial.print("Connexion au broker MQTT...");
|
||||||
if (client.connect("ESP8266Client")) {
|
if (client.connect(esp_name)) {
|
||||||
Serial.println("connecté");
|
Serial.println("connecté");
|
||||||
} else {
|
} else {
|
||||||
Serial.print("échec, rc=");
|
Serial.print("échec, rc=");
|
||||||
|
Loading…
Reference in New Issue
Block a user