You will need to break your "horrendous" task into smaller steps to enable the repetitive task to carry on.
I thought this would be the case. Thank you.
Got it. Thank you. I told you I was newbie.
There are RTOS libraries available for Arduino that'll allow you to have multiple threads albeit only running one at any moment.
Or you can code a way to do bites of the big task quickly enough to get back to the little task in time as UKHeliBob suggests.
But this sounds like a job for different hardware - consider a Raspberry Pi.
Yes, that will be the first thing I will try. However I would prefer to have control of motors even during calculation, because otherwise they may be moved by spindle etc, and I have no feedback from rotary encoders because those are 3-phase motors and I need 6 pins per motor, meaning I already ran out of pins just for motors and nothing else. Should the motors slip little error may occur and aggrevate over time.
I have Arduino UNO at a time and no chance of getting anything stronger soon enough. I have been naughty at work and now I have really bad references, so I dwell at gvt. support and work my way up again, in slightely different field. I already have a very fine job proposal if I can do what I am doing.
@JanKokes, read through this example.
It kinda does what you are suggesting.
Make sure you do not add any blocking code.
This looks promissing. It does mention high demands on SRAM, but that would be the case in either way. I saved the page with pdfs and will study it at home, I only have very limited time online, frequenting libraries. The ones with books. Same applies to ISRs and other things I may yet discover.
uMT works great on the DUE ...
Wonderful, thank you. I will consider DUE prior to Raspberry. I had no idea some Arduinos had dual processors. However I will not give up UNO any time soon.
Multitasking is easy peasy on Arduinos. I run.. 98% of my stuff in the "background".
Here's what you will need to do it, in a marketing arm waving kind of description.
1 A dynamic memory link list library. (Very handy!) You'll need a linked list manager class and a linked list object class.
2 Inherit these two classes. The manager becomes your background task manager. Your list objects become the base class your classes will inherit to make yours have an idle() method. (And a hookup() method)
3 Create a global instance of your manager class with a global function "void idle(void)" When you call this global function, the manager just runs down its linked list and calls every linked object's idle() method.
4 Place your global idle() function, as the first thing call in your loop(); function.
Now, each of your classes that inherit from "idler" will have an idle() method that is called repeatedly. You can have as many as you have RAM for, and they will all work away at their individual tasks. It works great for things like screen buttons and animations. Watching serial ports, managing hardware communication etc.
That's how I do it. Love how it works!
I have really hard time understanding. It sounds great however. Little more digging to do. Excellent. I thought you might answer me, I see your posts all over the place.
I reckon the approach in Several Things at a Time is even simpler. (And I am not claiming credit for any of the concepts within it)
Again, it looks promissing, and when I looked for it I did not find it. Thank you. Should I post my results back onto a forum when I have them?