Get a simple sine wave (not AC exactly, just biased)

Well, i want 8 or so sine waves concurrently.

I want to emulate a flame with leds.

I did random intensity and random intervals. That works OK, but, flames don't release light in a purely random way. It's only about half-random....

I thought maybe if I summed, say, 3 sines of varying wavelength and amplitude for

  • Monocrhome Component - added to every LED level
  • Chroma component - shorter wavlength, less amplitude. Applied evenly for LEDs of that color.
  • Segment - shortest and least amplitude. This pattern only applied to LED induvidually.

I'm depressed and suck at math, but I know I want wavelength to vary 30% or so within 90 degrees of the sine. Furthermore summing them should create a quasi-random/sinisoudal pattern that should be tunable to match a flame/fire.

Is there a simple function snipet?

Not sine-like as you requested, but check out these “flame” implementations:

I want to emulate a flame with leds.

Years ago when I worked in an electronics repair shop one of the other guys from the stores wanted something similar for something he was building. I can't remember exactly but I used something like a shift register, maybe 8 or 16 bits, with XOR feedback to make a pseudo random number generator. I experimented with various combinations of red, yellow and orange LEDs on various outputs until the person I was making it for proclaimed the effect was sufficiently realistic for his purposes. The shift register was clocked with a low frequency oscillator. In those days micro-controllers we only just appearing. These days this would be a simple thing to create in software.

Search for pseudo random number generator. The basic idea is a 2 input XOR from the last 2 outputs of a shift register back to the input plus something to make sure the whole thing can never be all zeros.

I gave up on my multi-dimensional raised in sine waves and everything not really good at math and sin. Anyway. Used random and that was * a coefficient and added to last value.. it looks a little smoother than full entropy. For some reason I can't bring the OTA up in IDE... It pings and replies on 8080. 8266