From d524d5171d8e8d08ff80b10b82d6281df0ff9e0e Mon Sep 17 00:00:00 2001 From: Alexander Bobkov Date: Wed, 25 Dec 2024 11:33:22 -0500 Subject: [PATCH] ESP-IDF Robot Controls --- ESP-IDF_Robot/main/blink_example_main.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ESP-IDF_Robot/main/blink_example_main.c b/ESP-IDF_Robot/main/blink_example_main.c index 4eabac547..4563055ad 100644 --- a/ESP-IDF_Robot/main/blink_example_main.c +++ b/ESP-IDF_Robot/main/blink_example_main.c @@ -723,6 +723,25 @@ void app_main(void) espnow_init(); //esp_now_add_peer(&peerInfo); + /* + ADC + */ + esp_err_t ret; + uint32_t ret_num = 0; + uint8_t result[READ_LEN] = {0}; + memset(result, 0xcc, EXAMPLE_READ_LEN); + + s_task_handle = xTaskGetCurrentTaskHandle(); + + adc_continuous_handle_t handle = NULL; + continuous_adc_init(channel, sizeof(channel) / sizeof(adc_channel_t), &handle); + + adc_continuous_evt_cbs_t cbs = { + .on_conv_done = s_conv_done_cb, + }; + ESP_ERROR_CHECK(adc_continuous_register_event_callbacks(handle, &cbs, NULL)); + ESP_ERROR_CHECK(adc_continuous_start(handle)); + while (1) { ESP_LOGI(TAG, "Turning the LED %s!", s_led_state == true ? "ON" : "OFF"); //blink_led();