RuiViana

arduinoFreeRTOS.ino

Feb 1st, 2019
162
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Blink Example
  2.  
  3.    This example code is in the Public Domain (or CC0 licensed, at your option.)
  4.  
  5.    Unless required by applicable law or agreed to in writing, this
  6.    software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  7.    CONDITIONS OF ANY KIND, either express or implied.
  8. */
  9.  
  10. /* Can run 'make menuconfig' to choose the GPIO to blink,
  11.    or you can edit the following line and set a number here.
  12. */
  13.  
  14. #define BLINK_GPIO GPIO_NUM_2
  15.  
  16. void blink_task(void *pvParameter)
  17. {
  18.   /* Configure the IOMUX register for pad BLINK_GPIO (some pads are
  19.      muxed to GPIO on reset already, but some default to other
  20.      functions and need to be switched to GPIO. Consult the
  21.      Technical Reference for a list of pads and their default
  22.      functions.)
  23.   */
  24. //  gpio_pad_select_gpio(BLINK_GPIO);
  25. //  /* Set the GPIO as a push/pull output */
  26. //  gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
  27. //  while (1) {
  28.     /* Blink off (output low) */
  29.     gpio_set_level(BLINK_GPIO, 0);
  30.     vTaskDelay(100 / portTICK_PERIOD_MS);
  31.     /* Blink on (output high) */
  32.     gpio_set_level(BLINK_GPIO, 1);
  33.     vTaskDelay(100 / portTICK_PERIOD_MS);
  34. //  }
  35. }
  36.  
  37. //void app_main()
  38. //{
  39. //  xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
  40. //}
  41. //
  42.  
  43. void setup() {
  44.    gpio_pad_select_gpio(BLINK_GPIO);
  45.   /* Set the GPIO as a push/pull output */
  46.   gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
  47.  
  48. }
  49.  
  50. void loop() {
  51.   xTaskCreate(&blink_task, "blink_task", configMINIMAL_STACK_SIZE, NULL, 5, NULL);
  52.  
  53. }
RAW Paste Data