Show Posts
Pages: [1] 2
1  Using Arduino / LEDs and Multiplexing / Re: LED HULAHOOP... err... on: August 28, 2013, 09:13:22 am
If you really want to use the FastSPI, checkout the FastSPI2 version.

Heres some examples of effects/code
2  Using Arduino / LEDs and Multiplexing / Re: RGB LED strip code questions (Sparkfun Pro Micro, LPD8806) on: August 20, 2013, 01:58:25 pm
Im about to start on an LED hula project myself.

I tackled #3 on a few projects and what I did was add an digitalread within any loop of those functions. If the button it hit, it will skip to the end.

Here is an example of the colorwipe:
void colorWipe(uint32_t c, uint8_t wait) {
  int i;
  for (i=0; i < strip.numPixels(); i++) {
   if(digitalRead(buttonPin) == HIGH){
  while (digitalRead(buttonPin) == HIGH){ } //do nothing while its pressed (or count for hold)
goto buttonPress;}
      strip.setPixelColor(i, c);;
  if (mode == nummodes) mode = 0;  // If its the last Mode, restart to 0 (Case1)
Once the button it pressed, the mode++ will change the case number.
The GOTO will skip to the end of the effect,and the end of the case. Then it will move to the next case.
Once the mode++ hits all of the cases, it restarts at 0.

And this is the basic code for the loop and shows the cases
void loop() {
   if (digitalRead(buttonPin)==HIGH) mode++;   // UPDATE MODE if button is caught here
   if (mode == nummodes) mode = 0;  // If its the last Mode, restart to 0 (Case1)
 while (digitalRead(button)==HIGH){
      //don't do anything else until the button is released
     for (int i=0; i < strip.numPixels(); i++) { // Clear strip data before start of next effect
     strip.setPixelColor(i, 0);
  modeSelect();  //Defaults to 0 = Case 1
void modeSelect(){
  switch (mode){
    case 1:
        // Send a simple pixel chase in...
colorChase(strip.Color(193,180,83), 20);   // blue
    case 2:
// Fill the entire strip with...
colorWipe(strip.Color(193,180,83), 20);     // gold
    case 3:
// Color sparkles
dither(strip.Color(0,0,127), 30);         // blue, slow
    case 4:
scanner(193,180,83, 15);        // gold, slow
    case 5:
      wave(strip.Color(0,0,127), 4, 40);        // icy

I would just make all of your current effects subfuctions, and just call the function in the cases.

May take some tweaking of this to work with what you have, but i have had good success with this method on a few projects.
3  Using Arduino / LEDs and Multiplexing / Re: LPD8806 - Sine Wave vs Pulse effect on: July 29, 2013, 08:31:27 am
Found it.. and it was a simple fix as I thought.

Old code line:
y = sin(PI * (float)cycles * (float)(x + i) / (float)strip.numPixels());

new code line:
y = sin(PI * (float)cycles * (float)(x + i));

Playing with the cycles and x variables changes how the sine wave fades.

4  Using Arduino / LEDs and Multiplexing / Re: LPD8806 - Sine Wave vs Pulse effect on: July 22, 2013, 03:19:52 pm
appreciate the help.

I want the color to "pulse" on and off.  So which ever color will start off, slowly fade on, then slowly fade back to off

Im still kicking myself for losing my code..   I think in the wave effect I might need to made the number of cycles = number of LEDs.. my original solution was something stupid simple.. sigh

I'll have more time to troubleshoot myself this week, have a deadline for needing wanting this by the 31st.
5  Community / Exhibition / Gallery / Re: LPD8806 LED Battle Beer Pong Table on: July 16, 2013, 09:19:31 am

Ya, some of the effects make it too dark.  Need to sort something better to make the cups more visible.

Might leave the triangle LEDs on all the time, and do effects on the middle strips instead perhaps.

The whole top is clear poly-carbonate (like plexiglass but doesnt scratch as easy).

Table also folds up in half for easy transport. Fits in my car nicely.

thanks for the feedback!
6  Community / Exhibition / Gallery / LPD8806 LED Battle Beer Pong Table on: July 15, 2013, 03:22:53 pm
Its nearly completed, just looking to add improvements to it.

Built it all from scratch.

Teensy 3.0 Arduino
LPD8806 LED strips
custom build beer pong frame/table

Using a 5V 8A adapter for power, but it also supports portable USB power batteries.

Still need to tweak the code and effects.  Really want to get the pulse/radiation type effect going.

Added two arcade buttons (1 on each end) to make the table strobe, as a means to distract your opponent.  It resets after 15 seconds, and the strobe lasts for 5.  I might make the reset a little bit longer.

Would love any suggestions and feedback to make this better!

7  Using Arduino / LEDs and Multiplexing / Re: LPD8806 - Sine Wave vs Pulse effect on: July 15, 2013, 03:15:44 pm
Updated libraries? where is this?
Ive been looking to the original one and it hasnt been updated in a while now..

8  Using Arduino / LEDs and Multiplexing / LPD8806 - Sine Wave vs Pulse effect on: July 12, 2013, 08:51:42 am
I had figured this out on a previous project for halloween, but I lost my original code and now Im banging my head on how I figured it out before.

I have LPD8806 strip of LEDS.  I want to get the "pulse" effect, where the entire strip goes on and off via the Sine wave.. nice smooth transition.

The Wave effect does this, but it passes through the entire strip.  I just want to modify it to do the same for every LED at the same time.  I'm fairly certain that I did a simple modification to the Wave function to do this the last time.  If i didnt, its probably why Im not figuring this out.

// Sine wave effect
#define PI 3.14159265
void wave(uint32_t c, int cycles, uint8_t wait) {
  float y;
  byte  r, g, b, r2, g2, b2;

  // Need to decompose color into its r, g, b elements
  g = (c >> 16) & 0x7f;
  r = (c >>  8) & 0x7f;
  b =  c        & 0x7f;

  for(int x=0; x<(strip.numPixels()*5); x++)
    for(int i=0; i<strip.numPixels(); i++) {
      y = sin(PI * (float)cycles * (float)(x + i) / (float)strip.numPixels());
      if(y >= 0.0) {
        // Peaks of sine wave are black
        y  = 1.0 - y; // Translate Y to 0.0 (top) to 1.0 (center)
        r2 = (byte)((float)r * y);
        g2 = (byte)((float)g * y);
        b2 = (byte)((float)b * y);
      } else {
        // Troughs of sine wave are black
        y += 1.0; // Translate Y to 0.0 (bottom) to 1.0 (center)
        r2 = (byte)((float)r * y);
        g2 = (byte)((float)g * y);
        b2 = (byte)((float)b * y);
      strip.setPixelColor(i, r2, g2, b2);

This post is my last resort before I let this tiny thing make me go crazy.

9  Using Arduino / LEDs and Multiplexing / Re: LPD8806 Addressable LED Strip Library (32 LEDs) on: November 06, 2012, 04:20:52 pm
The write up doesnt go into custom code but checkout my gist for some that I did to start, I tried to clean up the code to make it reader friendly:

I did another project for halloween and made a bunch more effects like pulse and multiple scanners/chasers.

Take a look at my basic project which uses only two colors and you should be able to see how they are done since they are very basic.

strip.setPixelColor(i, 0, 0,0); 
i = the pixel location. 0 is the first LED, 1 is the next, etc.
0,0,0 = the color using 21bit (0-127)

This will tell the LEDs to show the last setting.

You can create variable to use for the colors, and loops to set what color to set the strip.

for (int i = 0; i < 160; i++){       
      strip.setPixelColor(i, 0, 0,0);;
This example will turn all LEDS to 0 (off).  You could have the .show after the loop but its so fast it doesnt matter in this case.

Again, just play around with some of the basic effects and see what happens.  Easiest way to start to understand how the arduino code works.

10  Using Arduino / LEDs and Multiplexing / Re: Controlling strobe delay of two RGB LED strips on: October 18, 2012, 11:08:22 am
The issue I see is I dont see any code what makes the two delays specific to a certain strip.


Line 2 basically replaces the first (no strip is identified)

  if (strobe_delay > 5000){
    delay((strobe_delay - on_time) / 1000);
    delayMicroseconds(strobe_delay - on_time);

    if (strobe_delay2 > 5000){
    delay((strobe_delay2 - on_time2) / 1000);
    delayMicroseconds(strobe_delay2 - on_time2);

Again here, you set the proper numbers for the two different timings but the delay and delayMicroseconds functions doesnt specify which strip they apply to in the IF statements.

Need something along the lines of:

if (strobe_delay > 5000){
    strip1.delay((strobe_delay - on_time) / 1000);
    strip1.delayMicroseconds(strobe_delay - on_time);

    if (strobe_delay2 > 5000){
    strip2.delay((strobe_delay2 - on_time2) / 1000);
    strip2.delayMicroseconds(strobe_delay2 - on_time2);

That code will not be exact but I hope it helps clear what I believe to be the problem.
11  Community / Exhibition / Gallery / Re: LPD8806 LED strip project on: October 02, 2012, 03:22:06 pm
You sure that's not $40 per one(1) m ?  That's the standard retail price.  $40 for 5 meters is incredibly cheap.  You should double check that they aren't going to send you one(1) meter -cut- from a five(5) meter reel, which is what is done if you buy under 5 meters.

12  Using Arduino / LEDs and Multiplexing / Re: PWM rgb ledstrip on: October 02, 2012, 03:10:47 pm
Only suggestion I can think of is to try powering the LEDs with a separate 12v power source.  I'm wondering if the operation of the arduino if causing the VIN voltage to waiver on you.
13  Using Arduino / LEDs and Multiplexing / Re: PWM rgb ledstrip on: September 26, 2012, 09:44:10 am
Do you have power transistors for each color?

Flickering almost certainly leads to dirty power/ground issues.
14  Using Arduino / LEDs and Multiplexing / Re: LPD8806 RGB LED Strip - Reverse Engineer (with pics) questions/feedback on: September 25, 2012, 03:20:15 pm
I thought I'd better chime in on this as I recently read the post by "cranium" and took the chance myself based on that post. I ordered 15 meters of the same 5V RGB LED strip that you can find on and got them for something like $13 per meter. I was a little concerned about the process since I'd never ordered from China before or used Western Union but it all went smoothly. Just tested them a minute ago and they work perfectly. This is not an add. Just wanted to say thanks and give others a little confidence in buying from the same place. Yay! Thanks.
Here's where they have them listed:

I can second this. I order a couple from gree-leds and they arrived in under 2 days (which surprised me as I was expecting 1-3weeks).
15  Community / Exhibition / Gallery / Re: LPD8806 LED strip project on: September 12, 2012, 09:46:49 am
From  the 32pixel LPD8806 were $13/meter and the new 52pixels were $17/meter (plus change)
Pages: [1] 2