NeoPixel NeoMatrix 8X8 Sine Wave and Sawtooth Wave Sketches   Based on code by

NeoPixel NeoMatrix 8X8 Sine Wave and Sawtooth Wave Sketches

Based on code by @Sean_Clohesy , I was able to create sine wave and sawtooth wave functions for the NeoPixel NeoMatrix 8X8. I was able to use a number of the different ways to change color of the wave pixels including the palette crossfade code and other methods created by @Mark_Kriegsman .

How do you show all these methods? Use Mark’s Timecode Performance code.

The lower left hand pixel of the matrix is pixel 0. I have both the sine waves and the sawtooth waves going from bottom to top and from left to right.

Here is the sine wave video:

Here is the sawtooth wave video:

The sketches for these videos are located in GitHub at:

These sketches were run on the NeoPixel NeoMatrix 8X8 using the FastLED 3.1.1 library and the Arduino IDE 1.6.8. They ran successfully on an Arduino Uno, a DFRobot Beetle, an Adafruit Metro Mini and a Teensy 3.1 with level shifter. Between the MCU and the matrix, I use the two resistor fix protection circuit (see: Adafruit customer service forums • View topic - First LED frequently burning out on NeoPixels and look for - ws2812.jpeg) between the MCU data out pin and the matrix data in connection.

Each wave function uses the fadeToBlackBy function. If you change the “fade by” number 150 to a lower value like 20 to 40 then each “dot” in the wave will have a tail.

Thanks to the FastLED community who have provided a wealth of information that has allowed me to have lots of fun with RGB LEDs.

Excellent! I also love waves and FastLED. :slight_smile:

I’m wanting to give a talk at next year’s local Maker Faire about using sine waves to simplify the creation of basic LED animations. To me, nested for loops, blocking delays and and counting pixels are just not the way to go.

@Jason_Coon - Thank you for your response. Those videos of yours are great! I love your Fibonacci projects and code, too.

@Brian_van_vlymen - Thank you for your response.

@Andrew_Tuline - Thank you for your response. I am always trying to learn better ways to do things. Could you please provide me and others with some direction or code on how to make sine waves on a matrix without using nested for loops, blocking delays and counting pixels?

@Ken. As far as the basics of loops, blocking and counting, here’s something I put together, however adding the complexity you mention will have to wait a while.