hi
i search something like a "scheduler library" for Arduino Duemilanove who simulates multitasking.
for example i want to have a timer (every 1ms) who switches between multiple loop-functions.
multi-threading..
any ideas?
greets
stefan
hi
i search something like a "scheduler library" for Arduino Duemilanove who simulates multitasking.
for example i want to have a timer (every 1ms) who switches between multiple loop-functions.
multi-threading..
any ideas?
greets
stefan
for example i want to have a timer (every 1ms) who switches between multiple loop-functions.
The Duemilanove doesn't do multithreading. You can have a timer generate an interrupt at whatever interval you like. When that interrupt happens, you can change what the rest of the program is supposed to be doing. When the interrupt ends, though, YOU are responsible for making your code notice that what it should be doing has changed.
If you really want 1ms rates and pre-emption you need to be thinking about interrupts.
If something more like 5-20ms granularity with cooperative run-to-completion scheduling is acceptable, here's a library:
-br
TMoS:
i want to have a timer (every 1ms) who switches between multiple loop-functions.
If you just want your sketch to carry out different activities on a timed basis, that can be achieved easily without multithreading or any fancy scheduler. The sort of problem which requires multithreading, cooperative or preemptive scheduling is typically not the sort of problem that Arduino is suitable to solve, because it has so little processing power and memory that the overhead of complex scheduling mechanisms is prohibitive.
Thanks a lot for the answers.
But now, i have no idea which topic is the best for my problem.
I have a linux VM. This VM gets data from arduino over ethernet and saves the data in a DB. (the vm is polling the arduino).
Next, i have a light barrier (?) on my arduino. at „the moment of contact“ with the light barrier the arduino connect to the VM and get some data from the DB (over ethernet).
Now, the arduino sends the data over infrared to another device. (tv, soundbox, or something like this).. (the data = some commands (or multiple command chains with „sleep time“ (to let the other devices coming up… etc.)))
This can take up to 20s. In this 20s, the VM can’t get the data from arduino..
This can take up to 20s.
Why? Is that code blocking? Are you using delay()? If so, stop it.
yes.. i use delay(). Better idea?
google found this:
it's verry interesting but i tthink it does'ent help..
Edit
There is a multithead library
http://www.kwartzlab.ca/2010/09/arduino-multi-threading-librar/
TMoS:
multi-threading..
oh.. yes.
it's simple. ^^
thx