forked from dekuNukem/exixe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added crossfade funtion and examples
- Loading branch information
Showing
23 changed files
with
457 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
arduino_examples/3_loop_digit_crossfade/3_loop_digit_crossfade.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Demo for exixe modules | ||
https://github.com/dekuNukem/exixe | ||
exixe "Getting Started" guide | ||
https://github.com/dekuNukem/exixe/blob/master/getting_started.md | ||
Demo 3: Loop digits with crossfade animation | ||
*/ | ||
|
||
#include "exixe.h" | ||
|
||
// change this to the cs pin you're using | ||
int cs_pin = 10; | ||
unsigned char count; | ||
exixe my_tube = exixe(cs_pin); | ||
|
||
void setup() | ||
{ | ||
my_tube.clear(); | ||
my_tube.set_led(127, 0, 127); // purple | ||
} | ||
|
||
void loop() | ||
{ | ||
count++; | ||
/* | ||
1st arg: Digit to show, 0 to 9 | ||
2nd arg: how many frames does crossfade last, 30 frames = 1 second | ||
3rd arg: digit brightness, 0 to 127 | ||
4th arg: overdrive, 0 disable 1 enable | ||
This function sets up the crossfade animation | ||
call crossfade_run() to actually start it | ||
*/ | ||
my_tube.crossfade_init(count, 15, 127, 0); | ||
|
||
// crossfade_run() is non-blocking and returns right away | ||
// call it regularly(at least every 33ms) for a smooth animation | ||
// check its return value to see if the animation is finished | ||
while(my_tube.crossfade_run() == EXIXE_ANIMATION_IN_PROGRESS) | ||
; | ||
delay(250); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
arduino_examples/5_multiple_tubes_crossfade/5_multiple_tubes_crossfade.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
Demo for exixe modules | ||
https://github.com/dekuNukem/exixe | ||
exixe "Getting Started" guide | ||
https://github.com/dekuNukem/exixe/blob/master/getting_started.md | ||
Demo 5: Loop digits on two tubes with crossfade animation | ||
*/ | ||
|
||
|
||
#include "exixe.h" | ||
|
||
// change those to the cs pins you're using | ||
int cs1 = 10; | ||
int cs2 = 9; | ||
unsigned char count; | ||
|
||
exixe my_tube1 = exixe(cs1); | ||
exixe my_tube2 = exixe(cs2); | ||
|
||
void setup() | ||
{ | ||
my_tube1.clear(); | ||
my_tube2.clear(); | ||
my_tube1.set_led(127, 0, 127); // purple; | ||
my_tube2.set_led(127, 127, 0); // yellow; | ||
} | ||
|
||
void loop() | ||
{ | ||
count = (count + 1) % 10; // keep count between 0 to 9 | ||
|
||
my_tube1.crossfade_init(count, 15, 127, 0); | ||
my_tube2.crossfade_init(10-count, 15, 127, 0); | ||
|
||
while(1) | ||
{ | ||
unsigned char result1 = my_tube1.crossfade_run(); | ||
unsigned char result2 = my_tube2.crossfade_run(); | ||
if(result1 == EXIXE_ANIMATION_FINISHED && result2 == EXIXE_ANIMATION_FINISHED) | ||
break; | ||
} | ||
|
||
delay(250); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
arduino_library/exixe/examples/2_loop_digit_simple/2_loop_digit_simple.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Demo for exixe modules | ||
https://github.com/dekuNukem/exixe | ||
exixe "Getting Started" guide | ||
https://github.com/dekuNukem/exixe/blob/master/getting_started.md | ||
Demo 2: loop digits | ||
*/ | ||
|
||
#include "exixe.h" | ||
|
||
// change this to the cs pin you're using | ||
int cs_pin = 10; | ||
unsigned char count; | ||
|
||
exixe my_tube = exixe(cs_pin); | ||
|
||
void setup() | ||
{ | ||
my_tube.clear(); | ||
my_tube.set_led(127, 0, 127); // purple | ||
} | ||
|
||
void loop() | ||
{ | ||
count++; | ||
/* | ||
1st arg: Digit to show, 0 to 9 | ||
2nd arg: Digit brightness, 0 to 127 | ||
3rd arg: Overdrive, 0 disable 1 enable | ||
*/ | ||
my_tube.show_digit(count, 127, 0); | ||
delay(500); | ||
} |
44 changes: 44 additions & 0 deletions
44
arduino_library/exixe/examples/3_loop_digit_crossfade/3_loop_digit_crossfade.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
Demo for exixe modules | ||
https://github.com/dekuNukem/exixe | ||
exixe "Getting Started" guide | ||
https://github.com/dekuNukem/exixe/blob/master/getting_started.md | ||
Demo 3: Loop digits with crossfade animation | ||
*/ | ||
|
||
#include "exixe.h" | ||
|
||
// change this to the cs pin you're using | ||
int cs_pin = 10; | ||
unsigned char count; | ||
exixe my_tube = exixe(cs_pin); | ||
|
||
void setup() | ||
{ | ||
my_tube.clear(); | ||
my_tube.set_led(127, 0, 127); // purple | ||
} | ||
|
||
void loop() | ||
{ | ||
count++; | ||
/* | ||
1st arg: Digit to show, 0 to 9 | ||
2nd arg: how many frames does crossfade last, 30 frames = 1 second | ||
3rd arg: digit brightness, 0 to 127 | ||
4th arg: overdrive, 0 disable 1 enable | ||
This function sets up the crossfade animation | ||
call crossfade_run() to actually start it | ||
*/ | ||
my_tube.crossfade_init(count, 15, 127, 0); | ||
|
||
// crossfade_run() is non-blocking and returns right away | ||
// call it regularly(at least every 33ms) for a smooth animation | ||
// check its return value to see if the animation is finished | ||
while(my_tube.crossfade_run() == EXIXE_ANIMATION_IN_PROGRESS) | ||
; | ||
delay(250); | ||
} |
Oops, something went wrong.