Important changes to questions
We’re making some changes to Mbed Questions. From 10th December 2019 this site will be archived and new questions should be asked on our new forum site. Until that date you can continue to reply to existing questions here but can’t ask new questions.
1 year, 1 month ago.
Movement of Servos with Threads!
Good, I'm doing a hexapod that has 18 servos and 6 legs (3 servos for each leg) and in which I have declared the pins of each servo in a Multi-dimensional Arrays. In addition, I have a function that generates the movement of the servo depending on the degrees that it passes and a main that tests a servo in specific. My question is: I have a function called "mover_pata1" in which I pass a character as an argument and I create a switch in which depending on the selected character makes one movement or another the hexapod, but I would like all the movements of the servos were at the same time and I've been looking and I do not know if it could be with threads, create 1 thread for each leg (a total of 6 threads), tasks or I do not know. What can I use to make my code efficient and how would it be with a small example?
I attach my code:
Thank you !!
You need to log in to post a question