Hi, I am new to freertos and i have been trying out some stuffs . I have been able to make the led blink on my ardunio uno board but I am trying to make it blink for sometime andthen stop but i dont know how to implement that on freertos.
I know i need a for loop to indicate how mnay times it should blink but how to implement that on freertos is where i am stucked at.
Can someone please advice me on how to go about that?
Thank you.
Hers is an exmaple of the code making the led blink normally witout stopping
~~~
include “FreeRTOS.h”
include “task.h”
include “queue.h”
include “semphr.h”
include <avr/io.h>
include <avr/interrupt.h>
include <util/delay.h>
static void TaskBlinkyellowLED(void* pvParameters);
//———————————————————–
int main()
{
xTaskCreate(TaskBlinkyellowLED, (const portCHAR*) “yellowLED”, 256, NULL, 3, NULL);
vTaskStartScheduler();
for (;;)
;;
return 0;
}
//———————————————————–
// Main yellow LED Flash
static void TaskBlinkyellowLED(void* pvParameters)
{
// set pin 5 of PORTB for output
DDRB |= _BV(DDB5);
TickType_t xLastWakeTime = xTaskGetTickCount();
while (true)
{
// LED on
PORTB |= _BV(PORTB5);
vTaskDelayUntil(&xLastWakeTime, (1000/ portTICK_PERIOD_MS));
// LED off
PORTB &= ~_BV(PORTB5);
vTaskDelayUntil(&xLastWakeTime, (1000 / portTICK_PERIOD_MS));
}
vTaskDelete(NULL);
}
//———————————————————–
void vApplicationStackOverflowHook(TaskHandle_t xTask, portCHAR* pcTaskName)
{
// main LED on
DDRB |= _BV(DDB5);
PORTB |= _BV(PORTB5);
// die
while (true)
{
PORTB |=
BV(PORTB5);
_delayms(250);
PORTB &= ~
BV(PORTB5);
_delayms(250);
}
}
~~~