forked from dekuNukem/exixe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3_loop_digit_crossfade.ino
46 lines (37 loc) · 1.03 KB
/
3_loop_digit_crossfade.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
exixe modules:
https://github.com/dekuNukem/exixe
library docs:
https://github.com/dekuNukem/exixe/tree/master/arduino_library
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.spi_init();
my_tube.clear();
}
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)
;
my_tube.set_led(127, 64, 0); // orange
delay(250);
}