![]() |
Lab 4
Code for ECE 474 lab4
|
Code for Task RT-1. More...
#include <Arduino_FreeRTOS.h>
Macros | |
#define | LED_BLINK 49 |
pin for the external LED to blink More... | |
#define | LED_ON 100 |
time in miliseconds for the LED to stay on More... | |
#define | LED_OFF 200 |
time in miliseconds for the LED to stay off More... | |
Functions | |
void | TaskBlink (void *pvParameters) |
blink an external LED More... | |
void | setup () |
Funciton to setup RtOS tasks. More... | |
void | loop () |
loop though different funcitons, not in use for this lab More... | |
Code for Task RT-1.
The program to use FreeRTOS library to blink an off-board led. It turns on the LED for 100 miliseconds and then off for 200 miliseconds and so on.
#define LED_BLINK 49 |
pin for the external LED to blink
#define LED_OFF 200 |
time in miliseconds for the LED to stay off
#define LED_ON 100 |
time in miliseconds for the LED to stay on
void loop | ( | ) |
loop though different funcitons, not in use for this lab
This program uses RTOS so this function is not in use. Things are done in Tasks.
void setup | ( | ) |
Funciton to setup RtOS tasks.
Setup serial communication method and creat RTOS tasks. Set the priority of each task as well as its size.
void TaskBlink | ( | void * | pvParameters | ) |
blink an external LED
First it setup the LED in this function. Then in an infinite loop, it is going to turn LED on using digitalWrite()
function and wait for LED_ON
miliseconds using vTaskDelay()
. Similarly then it uses the same functions to turn it off for LED_OFF
miliseconds
pvParameters | parameters that FreeRTOS can pass in |