You can see my first approach above, but it was very fiddly:
I used a cylinder, then subdivision surface and the sine modifier. Apply all, then transform them to fit between the cubes. Since the transformation has to be the last step (because the sine modifier seems to be oriented along the main axes), it is nearly impossible to get several sine waves that connect different points to look the same (same period length, same amplitude etc.). Furthermore, subdivision surface does not seem to be the right modifier to subdivide the cube for this application - it becomes very slow, probably since the subdivision does not only take place in axial direction, but also along the circumfence.
Thank you very much, but I do not want to have a spiral, but a flat sine wave (this is more apparent in the picture below). The part that actually does the spiral in your case is apparently the SimpleDeform modifier, but that does not seem to allow for a flat sine wave. How can I realize that?
Wave using curve and array modifier
Set the resolution of the curve for low/high res version (curve resolution and bevel resolution). Use lower res and a subsurf modifier if you want
Rotate the empty to change the direction of the wave
Scale the base curve to change the frequency
Add a curve and a curve modifier if you want the array to follow a set curve
That is a good solution, thanks!
I have just a small question: Is it possible to have a non-integer array count? I.e. cut of some part of the last element so that it can closely follow a curve that has a length that is not a multiple of the period length? I could use stretch, but this would change the period length.
Alternatively, you could use Bezier Curve with 2 sets of points Hooked to 2 Empties which you then animate Z locations. http://www.pasteall.org/blend/35030