Professional Documents
Culture Documents
Electric Mechine Project Proposal
Electric Mechine Project Proposal
SUBMITTED BY:
Haseeb Ahmed
REGISTRATION NO:
FA20-BEE-001
SUBMITTED TO:
Dr.Adeel Akram
Course :
RTES
DATE:
25TH MARCH 2024
Q1: Round robin scheduling algorithm?
CODE:-
#include <FreeRTOS.h>
#include <task.h>
LastWakeTime = xTaskGetTickCount();
while (true) {
// Task 1 actions vTaskDelayUntil(&LastWakeTime,
Frequency);
}
}
void Task2(void *pvParameters) {
TickType_t LastWakeTime;
const TickType_t Frequency = 2000 / portTICK_PERIOD_MS; // Task 2 runs
every 2 seconds
LastWakeTime = xTaskGetTickCount();
while (true) {
// Task 2 actions vTaskDelayUntil(&LastWakeTime,
Frequency);
}
}
void setup() {
Serial.begin(9600);
vTaskStartScheduler();
}
void loop() {
// Empty loop as FreeRTOS scheduler will handle tasks
}
THANK YOU