mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-09 19:35:25 +00:00
ESPNOW + WiFi
This commit is contained in:
@@ -20,9 +20,11 @@ static void mqtt_publish_task(void *arg) {
|
|||||||
//float tsens_value = 0.0f;
|
//float tsens_value = 0.0f;
|
||||||
//temperature_sensor_get_celsius(temp_sensor, &tsens_value);
|
//temperature_sensor_get_celsius(temp_sensor, &tsens_value);
|
||||||
ESP_LOGW("ESP32-C3", "Temperature value %.02f ℃", tsens_value);
|
ESP_LOGW("ESP32-C3", "Temperature value %.02f ℃", tsens_value);
|
||||||
|
char temp_str[6];
|
||||||
|
snprintf(temp_str, sizeof(temp_str), "%.02f", tsens_value);
|
||||||
|
|
||||||
// Publish a message every 5 seconds
|
// Publish a message every 5 seconds
|
||||||
esp_mqtt_client_publish(mqtt_client, "/bitrider/temp", (char)tsens_value, 0, 1, 0);
|
esp_mqtt_client_publish(mqtt_client, "/bitrider/temp", temp_str, 0, 1, 0);
|
||||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||||
ESP_LOGI(MQTT_TAG, "Called task to publish topic /bitrider/temp");
|
ESP_LOGI(MQTT_TAG, "Called task to publish topic /bitrider/temp");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user