ambient light sensor
Some checks are pending
Deploy Jekyll with GitHub Pages dependencies preinstalled / build (push) Waiting to run
Deploy Jekyll with GitHub Pages dependencies preinstalled / deploy (push) Blocked by required conditions

This commit is contained in:
Alexandre B 2024-08-11 17:25:59 -04:00
parent 8fce2232b1
commit 2223157673

View File

@ -8,9 +8,13 @@
*/
#include <sdkconfig.h>
#include <freertos/FreeRTOS.h>
#include <freertos/timers.h>
#include <iot_button.h>
#include <esp_rmaker_core.h>
#include <esp_rmaker_standard_types.h>
#include <esp_rmaker_standard_params.h>
#include <esp_log.h>
@ -41,11 +45,22 @@ static bool g_power_state = DEFAULT_POWER;
// Define the name of app for logs.
static const char *TAG = "ESP32-Nodes Rainmaker Switch";
static float a_light;
static TimerHandle_t sensor_timer;
static void light_sensor_init(void) {
ESP_LOGI(TAG, "Initializing sensor ...");
}
static void light_sensor_update(TimerHandle_t handle) {
static float delta = 0.25;
a_light += delta;
esp_rmaker_param_update_and_report(
esp_rmaker_device_get_param_by_type(switch_device, ESP_RMAKER_PARAM_TEMPERATURE),
esp_rmaker_float(a_light));
}
static void app_bme280_init() {}
static void app_indicator_set(bool state)