Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 5 months ago.
Execute three while loops simultaneously
Hello. I am implementing individual pitch control for a wind turbine model using three servo motors controlled by mbed controller. Each motor's response will depend on individual sensors placed on the blades. For this application i will have three while loops to control each motor. Can anyone please help me with sample codes of how to execute three while loops simultaneously?
1 Answer
10 years, 5 months ago.
The mbed-rtos library will make this very easy for you. It's a Real Time Operating System that allows you to create multiple threads (AKA multiple while loops) with different priorities that are run by a preemptive scheduler. They won't all run simultaneously, but the scheduler will switch between them so fast they'll look like they're running simultaneously. The handbook page should get you up and running quickly.