You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
870 B
51 lines
870 B
# include <Arduino.h>
|
|
#include <analogWrite.h>
|
|
|
|
int counter = 0;
|
|
long int deltask1 = 1 * 5 * 1000 / portTICK_PERIOD_MS; // 5 seconds
|
|
int ledPin = 2;
|
|
|
|
////////////////////////
|
|
void task1(void * parameters) {
|
|
for(;;){
|
|
|
|
myFunk(); // function to be called
|
|
vTaskDelay(deltask1); // reset delay time
|
|
}
|
|
}
|
|
|
|
|
|
/////////////////////////
|
|
void myFunk(){
|
|
|
|
Serial.print("task counter: ");
|
|
Serial.println(counter++);
|
|
digitalWrite(ledPin,HIGH);
|
|
delay(1000);
|
|
digitalWrite(ledPin,LOW);
|
|
|
|
}
|
|
|
|
|
|
////////////////////////
|
|
void setup() {
|
|
|
|
Serial.begin(115200);
|
|
|
|
pinMode(ledPin, OUTPUT);
|
|
|
|
xTaskCreate(
|
|
task1, // function name
|
|
"Task1", // task name
|
|
1000, // stack size
|
|
NULL, // task parameters
|
|
1, // priority (low = more priority)
|
|
NULL // task handle
|
|
);
|
|
|
|
}
|
|
|
|
////////////////////////
|
|
void loop() {
|
|
// nada
|
|
}
|