Lab 4
Code for ECE 474 lab4
lab4rt1.ino File Reference

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...
 

Detailed Description

Code for Task RT-1.

Author
Fusco Li, Eric Yu
Date
10-June-2022

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.

Macro Definition Documentation

◆ LED_BLINK

#define LED_BLINK   49

pin for the external LED to blink

◆ LED_OFF

#define LED_OFF   200

time in miliseconds for the LED to stay off

◆ LED_ON

#define LED_ON   100

time in miliseconds for the LED to stay on

Function Documentation

◆ loop()

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.

◆ setup()

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.

◆ TaskBlink()

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

Parameters
pvParametersparameters that FreeRTOS can pass in