Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Multitasking multiple motors on: April 22, 2007, 08:18:01 pm

I uploaded a rough draft of the code to the lab site at k3. Here is a direct link to the zip:

There are some things worth telling you though:
1. I havn't considered the "overflow" in the millis() method, so it will probably stop working after about 9 hours
2. You can't have your own loop() method, see tab 2 (Taskmanager) for more on that!!! Just use the attachTask(int, void, long), detachTask(int) and changeTimeout(int) to control the different callbacks.
...probably some other issues...

How to use:
1. Write your variables and methods
2. use attachTask(index, callback method, timeout) in the setup
3. use detachTask(index) and changeTimeout(timeout) to alter your callbacks
(I have tried changing and detaching tasks from other tasks and it works fine, you can start a callback and have another callback ending it after a certain amount of time...)

Good luck! Hope it will be useful!

2  Forum 2005-2010 (read only) / Syntax & Programs / "Multitasking" keeping timeslots on: April 19, 2007, 05:18:44 pm
I was playing around with "multi-tasking" the arduino just the other night to be able to execute specific code in different timeslots. Maybe that solution could be of use for you. It was actually a student who asked me and I answered quickly that multi-tasking was not doable, but curiosity drove me to test some things and I have a sketch where I can attach up to ten (just a limit in the code) callback methods and set the timeout individually for each one of them. Minimum timeout is 1 ms but there is no guarantee that the code will execute at the exact set time (depends on what you place in your callback methods).

Reply if you want a link to the files. I havn't had the time to put them somewhere yet, but they'll be up soon...

3  Forum 2005-2010 (read only) / Syntax & Programs / Re: MIDI over serial Arduino code on: April 23, 2007, 03:08:54 pm
Have you tried just putting the serial communication at 31250 and send some basic MIDI commands. That could be one way of testing it. Sounds interesting that with the Roland driver, is it an emulator just forwarding serial data or is it a driver so that you see the device as a MIDI device?

Check out Tom Igoe's work, He has a MIDI jack connected directly to the serial pins of the board (not using the serial to USB), but then you need a MIDI input device on your computer. You should be able to see what data he is sending in the code though. Check out Tod's blog,, also. Found some stuff there ones...
4  Forum 2005-2010 (read only) / Interfacing / Re: getting 10V from arduino PWM on: April 23, 2007, 03:20:40 pm
One way of amplifying is to use just a transistor (depends on the application). I have used a HEXFET power MOSFET transistor, more preciely the IRFZ24. Work really fine together with PWM ports. For example driving large amount of LEDs at 12v from the Arduino and so on, handles large currents also (up to about 15 to 17 A @ 10 V).
5  Forum 2005-2010 (read only) / Interfacing / Re: Multiplexing pots on: April 23, 2007, 04:18:47 pm
When looking at a datasheet for the 74HCT4051 for example all time units are in ns (nano seconds). So the limitations is probably only in the Arduino. I think that the ADC, according to the datasheet of the Atmega, in the Arduino takes between 15 and 250us to convert depending on clock. As you can see the 150 to 200 Hz should be way within limits of what could be handled, one reading takes far less time than the 5 ms you were considering.

Nice to here about the outcome, post it somewhere!
Pages: [1]