Skip to content

Commit fdf3ed1

Browse files
slight modification to slow things down on the Teensy 3.x
1 parent 53034d7 commit fdf3ed1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

examples/plasma-10x10/plasma-10x10.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ void drawPlasma( unsigned long counter ) {
3636
float utime = float(counter)/TIME_DILATION;
3737

3838
leds.startDrawing();
39-
for (int col = 0; col < leds.columns(); col++ ) {
39+
for (unsigned int col = 0; col < leds.columns(); col++ ) {
4040
float x = ((float)col/((float)leds.columns()*SPACE_STRETCH_FACTOR)) - 0.5;
4141

42-
for (int row = 0; row < leds.rows(); row++ ) {
42+
for (unsigned int row = 0; row < leds.rows(); row++ ) {
4343
float y = ((float)row/((float)leds.rows()*SPACE_STRETCH_FACTOR)) - 0.5;
4444

4545
float v1 = sinf(x*10.0+utime);
@@ -87,7 +87,12 @@ unsigned long loopCounter = 0;
8787
unsigned long timeCount = 0;
8888
bool timeIncrement = true;
8989

90+
#if (defined(__arm__)&& defined(TEENSYDUINO))
91+
// slow things down for the Teensy
92+
const unsigned long loopMod = 20000;
93+
#else
9094
const unsigned long loopMod = 50;
95+
#endif
9196

9297
void loop() {
9398
leds.loop();

examples/plasma-8x8/plasma-8x8.ino

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ void drawPlasma( unsigned long counter ) {
3636
float utime = float(counter)/TIME_DILATION;
3737

3838
leds.startDrawing();
39-
for (int col = 0; col < leds.columns(); col++ ) {
39+
for (unsigned int col = 0; col < leds.columns(); col++ ) {
4040
float x = ((float)col/((float)leds.columns()*SPACE_STRETCH_FACTOR)) - 0.5;
4141

42-
for (int row = 0; row < leds.rows(); row++ ) {
42+
for (unsigned int row = 0; row < leds.rows(); row++ ) {
4343
float y = ((float)row/((float)leds.rows()*SPACE_STRETCH_FACTOR)) - 0.5;
4444

4545
float v1 = sinf(x*10.0+utime);
@@ -87,7 +87,12 @@ unsigned long loopCounter = 0;
8787
unsigned long timeCount = 0;
8888
bool timeIncrement = true;
8989

90+
#if (defined(__arm__)&& defined(TEENSYDUINO))
91+
// slow things down for the Teensy
92+
const unsigned long loopMod = 20000;
93+
#else
9094
const unsigned long loopMod = 500;
95+
#endif
9196

9297
void loop() {
9398
leds.loop();

0 commit comments

Comments
 (0)