Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define LED_BUILTIN 14
- TaskHandle_t Task1, Task2;
- void codeForTask1( void * parameter )
- {
- for (;;);
- }
- void codeForTask2( void * parameter )
- {
- for (;;);
- }
- // the setup function runs once when you press reset or power the board
- void setup() {
- Serial.begin(115200);
- // initialize digital pin LED_BUILTIN as an output.
- pinMode(LED_BUILTIN, OUTPUT);
- xTaskCreatePinnedToCore(
- codeForTask1, /* Task function. */
- "Task1", /* name of task. */
- 1000, /* Stack size of task */
- NULL, /* parameter of the task */
- 1, /* priority of the task */
- &Task1, /* Task handle to keep track of created task */
- 1); /* Core */
- delay(500);
- xTaskCreatePinnedToCore(
- codeForTask2, /* Task function. */
- "Task2", /* name of task. */
- 1000, /* Stack size of task */
- NULL, /* parameter of the task */
- 1, /* priority of the task */
- &Task2, /* Task handle to keep track of created task */
- 1); /* Core */ /* Core */
- }
- // the loop function runs over and over again forever
- void loop() {
- Serial.printf("Core %d\n ", xPortGetCoreID());
- digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
- delay(1000); // wait for a second
- digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
- delay(1000); // wait for a second
- }
Add Comment
Please, Sign In to add comment