A few notes to get blinker to work

Discussion in 'UDOO KEY' started by goephs, Jun 5, 2023.

Tags:
  1. goephs

    goephs UDOOer

    Joined:
    Jan 5, 2018
    Messages:
    3
    Likes Received:
    0
    I finally receive my udoo-key boards! I followed the getting started pages http://www.udoo.org/docs-key/Get_Started/Get_started_with_ESP32.html but I found that in Windows 10 I needed to make a few changes. I put together these steps so that I could reproduce them!

    Feel free to correct or comment on my steps...
    Windows 10 install ESP-IDF
    I found this youtube video helpful

    up to 3:23 to 3:35 in the video where I created the blinker project in addition to hello_world

    create blinker project
    add c code as noted on this udoo page http://www.udoo.org/docs-key/Get_Started/Get_started_with_ESP32.html
    1. in blinker directory run idf.py set-target esp32
    2. change blinker c code led references. I got errors on the line gpio_pad_select_gpio(B_LED_PIN)
    3. change to
      1. esp_rom_gpio_pad_select_gpio(B_LED_PIN)
      2. esp_rom_gpio_pad_select_gpio(Y_LED_PIN);
    4. Find the com port using the control panel. Mine was COM3
    5. On udoo-key, insert the jumper JP2 at the edge of the board and press the button SW3 between the board LEDs.
    Compile blinker project
    1. cd blinker
    2. run idf.py -p COM3 build flash monitor
    3. remove jumper JP2
    4. press SW3 button
    5. blinker will now execute and flash leds...nice!
    6. To exit from IDF monitor please use "Ctrl+]"
    more to learn...but at least I passed the 1st baby step! :)
     
  2. AlieKnalKoe

    AlieKnalKoe New Member

    Joined:
    Jul 11, 2023
    Messages:
    1
    Likes Received:
    0
    Updated version:
    For Windows OS installation, Espressif provides an installer which automatically performs everything.
    Firstly download the installer here and launch it.

    After the installation, you can open a ESP-IDF prompt by searching for ESP-IDF 5.1 CMD entry in the Start menu.
    Once launched, a new prompt is executed with the environment already loaded.

    If everything has been installed fine, you can create a project. To do that copy the code and flash the ESP32 in almost the same way explained for the Linux OS using an ESP-IDF command prompt.

    # First change to the example directory( to avoid compiling issues.
    cd C:\Espressif\frameworks\esp-idf-v5.1\examples
    # Open the project get-started\blink
    cd C:\Espressif\frameworks\esp-idf-v5.1\examples\get-started\blink
    #open the blink.c file in main
    notepad main\blink_example_main.c

    replace with:
    #include <stdio.h>
    #include <driver/gpio.h>
    #include <freertos/FreeRTOS.h>
    #include <freertos/task.h>
    #define B_LED_PIN GPIO_NUM_32
    #define Y_LED_PIN GPIO_NUM_33

    void led_blinker_task () {
    esp_rom_gpio_pad_select_gpio(B_LED_PIN);
    gpio_set_direction (B_LED_PIN, GPIO_MODE_OUTPUT);
    esp_rom_gpio_pad_select_gpio(Y_LED_PIN);
    gpio_set_direction (Y_LED_PIN, GPIO_MODE_OUTPUT);

    while (1) {
    gpio_set_level(Y_LED_PIN, 0);
    gpio_set_level(B_LED_PIN, 0);
    gpio_set_level(B_LED_PIN, 1);
    vTaskDelay(pdMS_TO_TICKS(128));
    gpio_set_level(B_LED_PIN, 0);
    vTaskDelay(pdMS_TO_TICKS(128));
    gpio_set_level(B_LED_PIN, 1);
    vTaskDelay(pdMS_TO_TICKS(128));
    gpio_set_level(B_LED_PIN, 0);
    gpio_set_level(Y_LED_PIN, 1);
    vTaskDelay(pdMS_TO_TICKS(2000));
    }
    }
    void app_main(void) {
    xTaskCreate (&led_blinker_task, "led_blinker_task", 1024, NULL, 2, NULL);
    }

    # set jumper next to esp chip and press button (EN) between leds when usb cable is in.
    # check your port numer in device manager and use your portnumber below
    idf.py -p COM3 build flash monitor

    when done remove jumper and press the button again te restart.
    Leds should be blinking.
     

Share This Page