Browse files

tweaked for teensyduino

  • Loading branch information...
1 parent 8a4c09b commit b5b6a55986b9b06edce6619cd4c7df5c059c1c95 @ladyada ladyada committed Jan 9, 2012
Showing with 17 additions and 2 deletions.
  1. +1 −1 examples/LEDbeltKit/LEDbeltKit.pde
  2. +16 −1 examples/advancedLEDbeltKit/advancedLEDbeltKit.pde
View
2 examples/LEDbeltKit/LEDbeltKit.pde
@@ -4,7 +4,7 @@
// Example to control LPD8806-based RGB LED Modules in a strip!
/*****************************************************************************/
-#ifdef USB_SERIAL
+#if defined(USB_SERIAL) || defined(USB_SERIAL_ADAFRUIT)
// this is for teensyduino support
int dataPin = 2;
int clockPin = 1;
View
17 examples/advancedLEDbeltKit/advancedLEDbeltKit.pde
@@ -17,7 +17,7 @@
#include "TimerOne.h"
-#ifdef USB_SERIAL
+#if defined(USB_SERIAL) || defined(USB_SERIAL_ADAFRUIT)
// this is for teensyduino support
int dataPin = 2;
int clockPin = 1;
@@ -61,6 +61,21 @@ int fxVars[3][50], // Effect instance variables (explained later)
tCounter = -1, // Countdown to next transition
transitionTime; // Duration (in frames) of current transition
+// function prototypes, leave these be :)
+void renderEffect00(byte idx);
+void renderEffect01(byte idx);
+void renderEffect02(byte idx);
+void renderEffect03(byte idx);
+void renderAlpha00(void);
+void renderAlpha01(void);
+void renderAlpha02(void);
+void renderAlpha03(void);
+void callback();
+byte gamma(byte x);
+long hsv2rgb(long h, byte s, byte v);
+char fixSin(int angle);
+char fixCos(int angle);
+
// List of image effect and alpha channel rendering functions; the code for
// each of these appears later in this file. Just a few to start with...
// simply append new ones to the appropriate list here:

10 comments on commit b5b6a55

@notcranium

There appears to be a limitation of 162 (5m + 2) pixels using this file. Is this a limitation of the Arduino or the code? I tried running 320 (10m) pixels and it does not work using anything past 162.

@PaintYourDragon
Adafruit Industries member

Most likely a RAM limitation. Can you describe your test setup, as in what other variables and data does your code have declared? Are you trying to use the FFT library at the same time?

@notcranium

No changes were made to the file when testing with the exception of using the SPI mode rather than the use of arbitrary pins. And of course I changed the number of pixels.

I have two strips linked together and powered from both ends. When uploading the sketch with > 162 pixels, it sits and does nothing. I thought it might be an interrupt issue and disabled the interrupt after loading loop() with the callback() code. Same result.

Running Strandtest works across all 10m.

@PaintYourDragon
Adafruit Industries member

callback()?

Ah! You're running the advancedLEDbeltKit sketch. That's a really RAM-intensive bit of code, and simply can't handle that many LEDs. Not a defect of the library.

@notcranium

I was afraid of that. Thanks for looking into it so quickly!

@okyeron

Which Teensy are you using? I think the regular Teensy2 does not have enough RAM.

But.. the Teensy2++ has enough RAM to run at least 264 pixels for me with the AdvancedLEDBeltKit sketch.

Have not tested with Teensy3 yet.

@notcranium
@okyeron

The thread mentioned teensyduino so I wasnt sure what board you were using. :)

I think the Ardunio Mega board would also give you enough RAM as well.

@notcranium
@notcranium

I just tried it with the Arduino MEGA 3560 and it works!

The UNO does not have enough memory to drive 320 pixels.

Thanks for the help. :)

Please sign in to comment.