![]() As long as you are not constantly swamping the serial port with data in/out, you just loop and check the time. You run 1 thread per motor and each thread will have its own instance of the motor controller code, which are just instances of the same library.īy the way, you don't need multiple cores to do this. Some of them also already have "motor control" functionality, but it's the same. Granted that if you are using python you can do the same with some if the python libraries out there that control the pis Io pins. The main thread then just keeps running to let you tell the threads want to do (speed up, stop, run backwards, etc.) It's code will use the same library to create another instance of the controller to control it's motor. Your app then starts another thread to control another motor. That thread uses your library to control it's motor. It starts a thread for a motor to be controlled. So you start your app, which runs in its own thread. Each thread will use the same library to control it's respective motor, So if need to control 4 motor, you can them in 4 separate threads, 1 per motor. You can run one motor per thread in a pi. ![]() The you use that library you ported to run a motor. ![]() If you have an Arduino library you already use/know how to use/like to use, you can port it to run in a pi.
0 Comments
Leave a Reply. |