Guest User

Untitled

a guest
Sep 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. #define LED_BUILTIN 14
  2.  
  3. TaskHandle_t Task1, Task2;
  4.  
  5.  
  6. void codeForTask1( void * parameter )
  7. {
  8. for (;;);
  9. }
  10.  
  11. void codeForTask2( void * parameter )
  12. {
  13. for (;;);
  14. }
  15.  
  16. // the setup function runs once when you press reset or power the board
  17. void setup() {
  18. Serial.begin(115200);
  19. // initialize digital pin LED_BUILTIN as an output.
  20. pinMode(LED_BUILTIN, OUTPUT);
  21.  
  22. xTaskCreatePinnedToCore(
  23. codeForTask1, /* Task function. */
  24. "Task1", /* name of task. */
  25. 1000, /* Stack size of task */
  26. NULL, /* parameter of the task */
  27. 1, /* priority of the task */
  28. &Task1, /* Task handle to keep track of created task */
  29. 1); /* Core */
  30. delay(500);
  31.  
  32. xTaskCreatePinnedToCore(
  33. codeForTask2, /* Task function. */
  34. "Task2", /* name of task. */
  35. 1000, /* Stack size of task */
  36. NULL, /* parameter of the task */
  37. 1, /* priority of the task */
  38. &Task2, /* Task handle to keep track of created task */
  39. 1); /* Core */ /* Core */
  40. }
  41.  
  42.  
  43.  
  44. // the loop function runs over and over again forever
  45. void loop() {
  46. Serial.printf("Core %d\n ", xPortGetCoreID());
  47. digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
  48. delay(1000); // wait for a second
  49. digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
  50. delay(1000); // wait for a second
  51. }
Add Comment
Please, Sign In to add comment