mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-08-08 08:16:08 +00:00
FreeRTOS
This commit is contained in:
@@ -104,20 +104,20 @@ void task1(void *pvParameters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void task2(void *pvParameters) {
|
void task2(void *pvParameters) {
|
||||||
int x = 0;
|
int y = 0;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
if (xSemaphoreTake(xMutex, 1500)) {
|
if (xSemaphoreTake(xMutex, 1500)) {
|
||||||
printf("Task 2 is running\n");
|
printf("Task 2 is running\n");
|
||||||
|
|
||||||
data data = {
|
SensorsData data = {
|
||||||
.num1 = x,
|
.num1 = 0,
|
||||||
.num2 = 0,
|
.num2 = y,
|
||||||
.num3 = 0,
|
.num3 = 0,
|
||||||
};
|
};
|
||||||
xQueueSend(xQueue1, &data, 0);
|
xQueueSend(xQueue1, &data, 0);
|
||||||
printf("Task 1 sent data");
|
printf("Task 1 sent data");
|
||||||
x++;
|
y++;
|
||||||
|
|
||||||
printf("This is Task #2\n\n");
|
printf("This is Task #2\n\n");
|
||||||
vTaskDelay((2000)); // Delay for 2 seconds
|
vTaskDelay((2000)); // Delay for 2 seconds
|
||||||
|
Reference in New Issue
Block a user