the question is do i need a table to store the sine wave or is there another possibilty to generate sine values on demand?

You can generate a sinewave using a digital resonator structure (a.k.a. IIR oscillator, IIR resonator). If you're not familiar with DSP, then perhaps stay away

If you are, I am talking about a two-pole (complex conjugate) system with poles right on the unit circle so it is marginally stable. Kick it and it oscillates. The angle of the poles determines the oscillation frequency and because it's second order the implementation equations are pretty simple.

You could generate sinusoid values on-the-fly using Taylor series and/or CORDIC algorithms.

If you do stick with the simpler lookup table, at high frequencies you can improve the "ugly" factor by interpolating between adjacent values in the table. Linear interpolation is pretty good, quadratic will be even better.

--

The

Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons