mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-11 09:50:17 +00:00
ESP-IDF Robot ESP NOW
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#include "esp_now.h"
|
||||
//#include "espnow_utils.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_system.h"
|
||||
|
||||
static const char *TAG = "ESP IDF Robot";
|
||||
|
||||
@@ -187,6 +190,19 @@ static void ledc_init (void) {
|
||||
//ESP_ERROR_CHECK(ledc_update_duty(LEDC_MODE, LEDC_CHANNEL));
|
||||
}
|
||||
|
||||
static void app_wifi_init()
|
||||
{
|
||||
esp_event_loop_create_default();
|
||||
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_NONE));
|
||||
ESP_ERROR_CHECK(esp_wifi_start());
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
// Initialize LED
|
||||
@@ -223,6 +239,11 @@ void app_main(void)
|
||||
//configure_dc_mc();
|
||||
printf("Added button interrupt");
|
||||
|
||||
espnow_storage_init();
|
||||
app_wifi_init();
|
||||
espnow_config_t espnow_config = ESPNOW_INIT_CONFIG_DEFAULT();
|
||||
espnow_init(&espnow_config);
|
||||
|
||||
while (1) {
|
||||
ESP_LOGI(TAG, "Turning the LED %s!", s_led_state == true ? "ON" : "OFF");
|
||||
//blink_led();
|
||||
|
Reference in New Issue
Block a user