Created
August 15, 2017 05:49
-
-
Save rclabs/fb6954f1de70e7b8f81cb83d38488552 to your computer and use it in GitHub Desktop.
Blink LED on esp32 thing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| https://cdn.sparkfun.com/datasheets/Wireless/WiFi/ESP32ThingV1.pdf - esp32 thing pinout | |
| https://cdn.sparkfun.com/assets/learn_tutorials/5/0/7/esp32-thing-schematic.pdf | |
| http://esp-idf.readthedocs.io/en/latest/api-reference/peripherals/gpio.html - GPIO documentation | |
| http://www.lucadentella.it/en/2016/12/22/esp32-4-flash-bootloader-e-freertos/ - RTOS explanation | |
| */ | |
| void loop_task(void *pvParameter) { | |
| #define PIN (1 << 5) | |
| gpio_config_t io_conf; | |
| io_conf.intr_type = GPIO_PIN_INTR_DISABLE; | |
| io_conf.mode = GPIO_MODE_OUTPUT; | |
| io_conf.pin_bit_mask = PIN; | |
| io_conf.pull_down_en = 0; | |
| io_conf.pull_up_en = 0; | |
| gpio_config(&io_conf); | |
| int val = 1; | |
| while(1) { | |
| vTaskDelay(1000 / portTICK_RATE_MS); | |
| gpio_set_level(GPIO_NUM_5, val); | |
| val = val == 0 ? 1 : 0; | |
| } | |
| } | |
| void app_main() | |
| { | |
| nvs_flash_init(); | |
| xTaskCreate(&loop_task, "loop_task", 2048, NULL, 5, NULL); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment