Go Down

Topic: Reading a lot of sensors at once (for) or one per loop. (Read 1 time) previous topic - next topic

cvmeer

Hello,

I want to make an extensive midi controller with loads of buttons, leds and pots.

I`m reading 64 potmeters through 4051 shift registers.

Is it better to read them all at once using a "for" loop, or read one potmeter per loop. (if i need to controll loads of other stuff and the controller needs to stay reactive)


Thanks in advance :)

Grumpy_Mike

Quote
I`m reading 64 potmeters through 4051 shift registers.

You threw me with that as the 4051 is not a shift register it is an analogue multiplexer.

I would go for reading on per loop, that way you keep the other stuff active and the latency low. As you only have two hands you are not likely to be adjusting more than two at once so you could get clever and first look at the last two that were touched and then the others later.

robtillaart

I would add a button/switch that only when pressed reads the potmeters.
An ADC can be noisy (a few bits) this may prevent small diffs in your math ultimately causing small(?) distortions in the midi signals e.g timing.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Grumpy_Mike

No all you do is only output the MIDI output when the difference between the last time you sent it and now is greater than a threshold, say 4. This way the noise gets ignored. It is a technique I have used successfully on a few MIDI projects. It prevents the MIDI output being flooded by lots of messages only showing a tiny change.

Go Up