Im trying to print the real time delay results of vTaskDelay .... is this code and the results ok?
Posted: Mon Sep 12, 2022 11:44 pm
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void app_main(void)
{
float mesurment;
int first_time;
int second_time;
for (int i = 10; i < 150; i+=10)
{
printf("\n===========\ntime accuracy for %d miliseconds delay\n",i);
first_time=esp_timer_get_time();
vTaskDelay(i/portTICK_RATE_MS);
second_time=esp_timer_get_time();
mesurment=second_time-first_time;
printf("Real mesured time results for %dms delay is: %fms\n===========",i, mesurment/1000);
}
}
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
void app_main(void)
{
float mesurment;
int first_time;
int second_time;
for (int i = 10; i < 150; i+=10)
{
printf("\n===========\ntime accuracy for %d miliseconds delay\n",i);
first_time=esp_timer_get_time();
vTaskDelay(i/portTICK_RATE_MS);
second_time=esp_timer_get_time();
mesurment=second_time-first_time;
printf("Real mesured time results for %dms delay is: %fms\n===========",i, mesurment/1000);
}
}