Switching between multiple tasks, Part 2 [STM32 and FreeRTOS]
![](https://en.depfields.com/wp-content/uploads/2020/06/programming-1873854_640.png)
This is a sample program that combines task switching and USART communication, and manages task execution and suspension based on whether or not the command code given externally matches.
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
This is a program that sets command codes for task switching in advance and executes the task specified by the command code and stops other tasks when the externally given code matches.
![](https://en.depfields.com/wp-content/uploads/2020/06/rtos-led-nucleo2_en.jpg)
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
This time, instead of using an input switch, a command is used to switch between Task A and Task B. The command string "TaskA@" switches to Task A, and "TaskB@" switches to Task B, which is displayed on the screen.
The '@' at the end of the command is to recognize the end of the input string. Instead of '@', an enter key (CR) input can be used as the end of the string, in which case the ASCII code is 0x0D.